package cn.com.elite;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class ImportServlet extends HttpServlet{
	private static final Log log=LogFactory.getLog(ImportServlet.class);
	public static cn.com.elite.ISBean ebean;
	public static WebApplicationContext wac;
	private int yingxiao_parserXml_flag=1;
	
	public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException{
		this.doPost(request, response);
	}
	private String getValue(Element element,String name,String c){
		try{
			if(element!=null){
				c=element.getText();
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
		}
        log.debug(name+":"+c);
        return c;
	}
	private String getDateValue(String a){
		String b=null;
		try{
			if(a!=null&&!a.equals("")&&a.length()>0){
				b="to_date('"+a+"','yyyy-mm-dd')";
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
		}
		return b;
	}
	private String getStringValue(String a){
		String b=null;
		try{
			if(a!=null&&!a.equals("")&&a.length()>0){
				b="'"+a+"'";
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
		}
		return b;
	}
	public ISBean getbean(){
		ServletContext application;    
        application = getServletContext();   
        wac=WebApplicationContextUtils.getWebApplicationContext(application);//获取spring的context  
        cn.com.elite.ISBean ebean=(cn.com.elite.ISBean)wac.getBean("ebean");  
        return ebean;
	} 
	public void init(){
		ebean=getbean();
	}
	private void parserXml1(Element DM_FS_TELLER,String HALL_ID,String DEPT_ID)throws Exception{
		String TELLER_ID=Util.ReturnCode();
		String TELLER_CODE=null;
		String REAL_NAME=null;
		String GENDER=null;
		String BIRTHDAY=null;
		String CERTI_TYPE=null;
		String CERTI_CODE=null;
		String STATUS=null;
		String USER_NAME=null;
		String TELLER_CATE=null;
		String TELLER_GRADE=null;
		String SUPERVISE_ID=null;
		String RECOMMEND_ID=null;
		String ADDR=null;
		String ZIP=null;
		String TEL=null;
		String MP=null;
		String EDUCATION_ID=null;
		String ENROLL_DATE=null;
		String QUIT_DATE=null;
		String SYS_EVENT_ID=null;
		String SYS_EVENT_CLERK=null;
		String SYS_EVENT_TIME=null;
		String SYS_NXT_EVENT_TIME=null;
		String SYS_DEALING=null;
		String GRADE_DATE=null;
		String GRADE_CHG_DESC=null;
		String WORK_DATE=null;
		String REGULAR_DATE=null;
		String IS_OUTSOURCE=null;
		String MEMO=null;
		String UPDATE_TIME=null;
		String QUAL_CERT_END_DATE=null;
		String IS_TRAINEE=null;
		String QUAL_CERT_CODE=null;
		TELLER_CODE=getValue(DM_FS_TELLER.element("TELLER_CODE"),"TELLER_CODE",TELLER_CODE);
		REAL_NAME=getValue(DM_FS_TELLER.element("REAL_NAME"),"REAL_NAME",REAL_NAME);
		GENDER=getValue(DM_FS_TELLER.element("GENDER"),"GENDER",GENDER);
		BIRTHDAY=getValue(DM_FS_TELLER.element("BIRTHDAY"),"BIRTHDAY",BIRTHDAY);
		CERTI_TYPE=getValue(DM_FS_TELLER.element("CERTI_TYPE"),"CERTI_TYPE",CERTI_TYPE);
		CERTI_CODE=getValue(DM_FS_TELLER.element("CERTI_CODE"),"CERTI_CODE",CERTI_CODE);
		STATUS=getValue(DM_FS_TELLER.element("STATUS"),"STATUS",STATUS);
		USER_NAME=getValue(DM_FS_TELLER.element("USER_NAME"),"USER_NAME",USER_NAME);
		TELLER_CATE=getValue(DM_FS_TELLER.element("TELLER_CATE"),"TELLER_CATE",TELLER_CATE);
		TELLER_GRADE=getValue(DM_FS_TELLER.element("TELLER_GRADE"),"TELLER_GRADE",TELLER_GRADE);
		SUPERVISE_ID=getValue(DM_FS_TELLER.element("SUPERVISE_ID"),"SUPERVISE_ID",SUPERVISE_ID);
		RECOMMEND_ID=getValue(DM_FS_TELLER.element("RECOMMEND_ID"),"RECOMMEND_ID",RECOMMEND_ID);
		ADDR=getValue(DM_FS_TELLER.element("ADDR"),"ADDR",ADDR);
		ZIP=getValue(DM_FS_TELLER.element("ZIP"),"ZIP",ZIP);
		TEL=getValue(DM_FS_TELLER.element("TEL"),"TEL",TEL);
		MP=getValue(DM_FS_TELLER.element("MP"),"MP",MP);
		EDUCATION_ID=getValue(DM_FS_TELLER.element("EDUCATION_ID"),"EDUCATION_ID",EDUCATION_ID);
		ENROLL_DATE=getValue(DM_FS_TELLER.element("ENROLL_DATE"),"ENROLL_DATE",ENROLL_DATE);
		QUIT_DATE=getValue(DM_FS_TELLER.element("QUIT_DATE"),"QUIT_DATE",QUIT_DATE);
		SYS_EVENT_ID=getValue(DM_FS_TELLER.element("SYS_EVENT_ID"),"SYS_EVENT_ID",SYS_EVENT_ID);
		SYS_EVENT_CLERK=getValue(DM_FS_TELLER.element("SYS_EVENT_CLERK"),"SYS_EVENT_CLERK",SYS_EVENT_CLERK);
		SYS_EVENT_TIME=getValue(DM_FS_TELLER.element("SYS_EVENT_TIME"),"SYS_EVENT_TIME",SYS_EVENT_TIME);
		SYS_NXT_EVENT_TIME=getValue(DM_FS_TELLER.element("SYS_NXT_EVENT_TIME"),"SYS_NXT_EVENT_TIME",SYS_NXT_EVENT_TIME);
		SYS_DEALING=getValue(DM_FS_TELLER.element("SYS_DEALING"),"SYS_DEALING",SYS_DEALING);
		GRADE_DATE=getValue(DM_FS_TELLER.element("GRADE_DATE"),"GRADE_DATE",GRADE_DATE);
		GRADE_CHG_DESC=getValue(DM_FS_TELLER.element("GRADE_CHG_DESC"),"GRADE_CHG_DESC",GRADE_CHG_DESC);
		WORK_DATE=getValue(DM_FS_TELLER.element("WORK_DATE"),"WORK_DATE",WORK_DATE);
		REGULAR_DATE=getValue(DM_FS_TELLER.element("REGULAR_DATE"),"REGULAR_DATE",REGULAR_DATE);
		IS_OUTSOURCE=getValue(DM_FS_TELLER.element("IS_OUTSOURCE"),"IS_OUTSOURCE",IS_OUTSOURCE);
		MEMO=getValue(DM_FS_TELLER.element("MEMO"),"MEMO",MEMO);
		UPDATE_TIME=getValue(DM_FS_TELLER.element("UPDATE_TIME"),"UPDATE_TIME",UPDATE_TIME);
		QUAL_CERT_END_DATE=getValue(DM_FS_TELLER.element("QUAL_CERT_END_DATE"),"QUAL_CERT_END_DATE",QUAL_CERT_END_DATE);
		IS_TRAINEE=getValue(DM_FS_TELLER.element("IS_TRAINEE"),"IS_TRAINEE",IS_TRAINEE);
		QUAL_CERT_CODE=getValue(DM_FS_TELLER.element("QUAL_CERT_CODE"),"QUAL_CERT_CODE",QUAL_CERT_CODE);
		String sql="";
		List list=ebean.chaxun_sql("select * from DM_FS_TELLER where TELLER_CODE='"+TELLER_CODE+"'");
		if(list!=null&&list.size()>0){
			sql="update DM_FS_TELLER set DEPT_ID="+DEPT_ID+",REAL_NAME="+getStringValue(REAL_NAME)+",GENDER="+GENDER+",BIRTHDAY="+getDateValue(BIRTHDAY)+",CERTI_TYPE="+CERTI_TYPE+"," +
					"CERTI_CODE="+getStringValue(CERTI_CODE)+",STATUS="+STATUS+",USER_NAME="+getStringValue(USER_NAME)+",TELLER_CATE="+TELLER_CATE+",TELLER_GRADE="+TELLER_GRADE+"," +
							"SUPERVISE_ID="+SUPERVISE_ID+",RECOMMEND_ID="+RECOMMEND_ID+",ADDR="+getStringValue(ADDR)+",ZIP="+getStringValue(ZIP)+"," +
									"TEL="+getStringValue(TEL)+",MP="+getStringValue(MP)+",EDUCATION_ID="+EDUCATION_ID+",ENROLL_DATE="+getDateValue(ENROLL_DATE)+"," +
											"QUIT_DATE="+getDateValue(QUIT_DATE)+",FCD=sysdate,SYS_EVENT_ID="+SYS_EVENT_ID+",SYS_EVENT_CLERK="+SYS_EVENT_CLERK+"," +
													"SYS_EVENT_TIME="+getDateValue(SYS_EVENT_TIME)+",SYS_NXT_EVENT_TIME="+getDateValue(SYS_NXT_EVENT_TIME)+",SYS_DEALING="+getStringValue(SYS_DEALING)+"," +
															"GRADE_DATE="+getDateValue(GRADE_DATE)+",GRADE_CHG_DESC="+getStringValue(GRADE_CHG_DESC)+",QUAL_CERT_CODE="+getStringValue(QUAL_CERT_CODE)+"," +
																	"WORK_DATE="+getDateValue(WORK_DATE)+",REGULAR_DATE="+getDateValue(REGULAR_DATE)+",IS_OUTSOURCE="+getStringValue(IS_OUTSOURCE)+"," +
																			"MEMO="+getStringValue(MEMO)+",UPDATE_TIME="+getDateValue(UPDATE_TIME)+",QUAL_CERT_END_DATE="+getDateValue(QUAL_CERT_END_DATE)+",IS_TRAINEE="+getStringValue(IS_TRAINEE)+" where TELLER_CODE='"+TELLER_CODE+"'";
		}else{
			sql="insert into DM_FS_TELLER(TELLER_ID,TELLER_CODE,REAL_NAME," + 
			"GENDER,BIRTHDAY,CERTI_TYPE,CERTI_CODE,STATUS,USER_NAME,HALL_ID,DEPT_ID,TELLER_CATE,TELLER_GRADE," +
			"SUPERVISE_ID,RECOMMEND_ID,ADDR,ZIP,TEL,MP,EDUCATION_ID,ENROLL_DATE,QUIT_DATE,FCD,SYS_EVENT_ID,SYS_EVENT_CLERK," +
			"SYS_EVENT_TIME,SYS_NXT_EVENT_TIME,SYS_DEALING,GRADE_DATE,GRADE_CHG_DESC,QUAL_CERT_CODE,WORK_DATE,REGULAR_DATE,IS_OUTSOURCE," +
			"MEMO,UPDATE_TIME,QUAL_CERT_END_DATE,IS_TRAINEE)" +
			"Values" +
			"("+TELLER_ID+","+getStringValue(TELLER_CODE)+","+getStringValue(REAL_NAME)+","+GENDER+","+getDateValue(BIRTHDAY)+","+CERTI_TYPE+"," +
					""+getStringValue(CERTI_CODE)+","+STATUS+"," +
					""+getStringValue(USER_NAME)+","+HALL_ID+","+DEPT_ID+","+TELLER_CATE+","+TELLER_GRADE+","+SUPERVISE_ID+","+RECOMMEND_ID+"," +
							""+getStringValue(ADDR)+","+getStringValue(ZIP)+"," +
							""+getStringValue(TEL)+","+getStringValue(MP)+","+EDUCATION_ID+","+getDateValue(ENROLL_DATE)+","+getDateValue(QUIT_DATE)+"," +
									"sysdate,"+SYS_EVENT_ID+","+SYS_EVENT_CLERK+"," +
									""+getDateValue(SYS_EVENT_TIME)+","+getDateValue(SYS_NXT_EVENT_TIME)+","+getStringValue(SYS_DEALING)+"," +
											""+getDateValue(GRADE_DATE)+","+getStringValue(GRADE_CHG_DESC)+"," +
											""+getStringValue(QUAL_CERT_CODE)+","+getDateValue(WORK_DATE)+","+getDateValue(REGULAR_DATE)+"," +
													""+getStringValue(IS_OUTSOURCE)+","+getStringValue(MEMO)+","+getDateValue(UPDATE_TIME)+"," +
													""+getDateValue(QUAL_CERT_END_DATE)+","+getStringValue(IS_TRAINEE)+")";
		}
		try{
			ebean.update_sql(sql);
		}catch(Exception e){
			log.error(Util.getERRO(e));
			sql="insert into DM_FS_TELLER_bak(TELLER_ID,TELLER_CODE,REAL_NAME," +
			"GENDER,BIRTHDAY,CERTI_TYPE,CERTI_CODE,STATUS,USER_NAME,HALL_ID,DEPT_ID,TELLER_CATE,TELLER_GRADE," +
			"SUPERVISE_ID,RECOMMEND_ID,ADDR,ZIP,TEL,MP,EDUCATION_ID,ENROLL_DATE,QUIT_DATE,FCD,SYS_EVENT_ID,SYS_EVENT_CLERK," +
			"SYS_EVENT_TIME,SYS_NXT_EVENT_TIME,SYS_DEALING,GRADE_DATE,GRADE_CHG_DESC,QUAL_CERT_CODE,WORK_DATE,REGULAR_DATE,IS_OUTSOURCE," +
			"MEMO,UPDATE_TIME,QUAL_CERT_END_DATE,IS_TRAINEE)" +
			"Values" +
			"("+getStringValue(TELLER_ID)+","+getStringValue(TELLER_CODE)+","+getStringValue(REAL_NAME)+","+getStringValue(GENDER)+"," +
					""+getStringValue(BIRTHDAY)+","+getStringValue(CERTI_TYPE)+"," +
					""+getStringValue(CERTI_CODE)+","+getStringValue(STATUS)+"," +
					""+getStringValue(USER_NAME)+","+getStringValue(HALL_ID)+","+getStringValue(DEPT_ID)+"," +
							""+getStringValue(TELLER_CATE)+","+getStringValue(TELLER_GRADE)+"," +
									""+getStringValue(SUPERVISE_ID)+","+getStringValue(RECOMMEND_ID)+"," +
							""+getStringValue(ADDR)+","+getStringValue(ZIP)+"," +
							""+getStringValue(TEL)+","+getStringValue(MP)+","+getStringValue(EDUCATION_ID)+","+getStringValue(ENROLL_DATE)+"," +
									""+getStringValue(QUIT_DATE)+"," +
									"'sysdate',"+getStringValue(SYS_EVENT_ID)+","+getStringValue(SYS_EVENT_CLERK)+"," +
									""+getStringValue(SYS_EVENT_TIME)+","+getStringValue(SYS_NXT_EVENT_TIME)+","+getStringValue(SYS_DEALING)+"," +
											""+getStringValue(GRADE_DATE)+","+getStringValue(GRADE_CHG_DESC)+"," +
											""+getStringValue(QUAL_CERT_CODE)+","+getStringValue(WORK_DATE)+","+getStringValue(REGULAR_DATE)+"," +
													""+getStringValue(IS_OUTSOURCE)+","+getStringValue(MEMO)+","+getStringValue(UPDATE_TIME)+"," +
													""+getStringValue(QUAL_CERT_END_DATE)+","+getStringValue(IS_TRAINEE)+")";
			ebean.update_sql(sql);
			return;
		}
	}
	private void parserXml(Element DM_FS_SEAT_DEPT,String HALL_ID)throws Exception{
		if(DM_FS_SEAT_DEPT!=null){
			String DEPT_ID=Util.ReturnCode();
			String DEPT_CODE=null;
			String PARENT_CODE=null;
			String LEAF=null;
			String DEPT_NAME=null;
			String DEPT_ABBR=null;
			String STATUS=null;
			String DEPT_CATE=null;
			String MANAGE_ID=null;
			String FCD=null;
			String UPDATE_TIME=null;			
			DEPT_CODE=getValue(DM_FS_SEAT_DEPT.element("DEPT_CODE"),"DEPT_CODE",DEPT_CODE);
			PARENT_CODE=getValue(DM_FS_SEAT_DEPT.element("PARENT_CODE"),"PARENT_CODE",PARENT_CODE);
            if(PARENT_CODE!=null&&PARENT_CODE.equals("")){
            	PARENT_CODE=null;
            }
			LEAF=getValue(DM_FS_SEAT_DEPT.element("LEAF"),"LEAF",LEAF);
			DEPT_NAME=getValue(DM_FS_SEAT_DEPT.element("DEPT_NAME"),"DEPT_NAME",DEPT_NAME);
			DEPT_ABBR=getValue(DM_FS_SEAT_DEPT.element("DEPT_ABBR"),"DEPT_ABBR",DEPT_ABBR);
			STATUS=getValue(DM_FS_SEAT_DEPT.element("STATUS"),"STATUS",STATUS);
			DEPT_CATE=getValue(DM_FS_SEAT_DEPT.element("DEPT_CATE"),"DEPT_CATE",DEPT_CATE);
			MANAGE_ID=getValue(DM_FS_SEAT_DEPT.element("MANAGE_ID"),"MANAGE_ID",MANAGE_ID);
			UPDATE_TIME=getValue(DM_FS_SEAT_DEPT.element("UPDATE_TIME"),"UPDATE_TIME",UPDATE_TIME);
			String sql="";
			if(PARENT_CODE!=null&&!PARENT_CODE.equals("")&&PARENT_CODE.length()>0){
				try{
					PARENT_CODE=ebean.chaxunString("select dept_id from dm_fs_seat_dept where dept_code='"+PARENT_CODE+"'");
				}catch(Exception e){
					log.error(Util.getERRO(e));
					sql="insert into DM_FS_SEAT_DEPT_bak(DEPT_ID,DEPT_CODE,PARENT_ID,LEAF,DEPT_NAME,DEPT_ABBR," +
					"STATUS,HALL_ID,DEPT_CATE,MANAGE_ID,FCD,UPDATE_TIME)Values("+getStringValue(DEPT_ID)+","+getStringValue(DEPT_CODE)+"," +
							""+getStringValue(PARENT_CODE)+","+getStringValue(LEAF)+"," +
							""+getStringValue(DEPT_NAME)+","+getStringValue(DEPT_ABBR)+","+getStringValue(STATUS)+","+getStringValue(HALL_ID)+","+getStringValue(DEPT_CATE)+"," +
									""+getStringValue(MANAGE_ID)+",'sysdate',"+getDateValue(UPDATE_TIME)+")";
					ebean.update_sql(sql);
					return;
				}
			}
			List list=ebean.chaxun_sql("select * from DM_FS_SEAT_DEPT where DEPT_CODE='"+DEPT_CODE+"'");
			if(list!=null&&list.size()>0){
				Map map=(Map)list.get(0);
				BigDecimal DEPT_ID1=(BigDecimal)map.get("DEPT_ID");
				DEPT_ID=DEPT_ID1.toString();
				sql="update DM_FS_SEAT_DEPT set LEAF="+getStringValue(LEAF)+",DEPT_NAME="+getStringValue(DEPT_NAME)+",DEPT_ABBR="+getStringValue(DEPT_ABBR)+",STATUS="+STATUS+"," +
				"DEPT_CATE="+DEPT_CATE+",MANAGE_ID="+MANAGE_ID+",FCD=sysdate,UPDATE_TIME="+getDateValue(UPDATE_TIME)+" where DEPT_CODE='"+DEPT_CODE+"'";
			}else{
				sql="insert into DM_FS_SEAT_DEPT(DEPT_ID,DEPT_CODE,PARENT_ID,LEAF,DEPT_NAME,DEPT_ABBR," +
				"STATUS,HALL_ID,DEPT_CATE,MANAGE_ID,FCD,UPDATE_TIME)Values("+DEPT_ID+","+getStringValue(DEPT_CODE)+","+PARENT_CODE+","+getStringValue(LEAF)+"," +
						""+getStringValue(DEPT_NAME)+","+getStringValue(DEPT_ABBR)+","+STATUS+","+HALL_ID+","+DEPT_CATE+"," +
								""+MANAGE_ID+",sysdate,"+getDateValue(UPDATE_TIME)+")";
			}
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				sql="insert into DM_FS_SEAT_DEPT_bak(DEPT_ID,DEPT_CODE,PARENT_ID,LEAF,DEPT_NAME,DEPT_ABBR," +
				"STATUS,HALL_ID,DEPT_CATE,MANAGE_ID,FCD,UPDATE_TIME)Values("+getStringValue(DEPT_ID)+","+getStringValue(DEPT_CODE)+"," +
						""+getStringValue(PARENT_CODE)+","+getStringValue(LEAF)+"," +
						""+getStringValue(DEPT_NAME)+","+getStringValue(DEPT_ABBR)+","+getStringValue(STATUS)+","+getStringValue(HALL_ID)+","+getStringValue(DEPT_CATE)+"," +
								""+getStringValue(MANAGE_ID)+",'sysdate',"+getDateValue(UPDATE_TIME)+")";
				ebean.update_sql(sql);
				return;
			}
			Iterator iters2=DM_FS_SEAT_DEPT.elementIterator();
			while(iters2.hasNext()){
				Element DM_FS_TELLER=(Element)iters2.next();
				if(DM_FS_TELLER.getName().equals("DM_FS_TELLER")){
					if(DM_FS_TELLER!=null){
						parserXml1(DM_FS_TELLER,HALL_ID,DEPT_ID);
					}
				}
			}	
		}
	}
	private void biaozhun_parserXml5(Element DM_PR_ANNC_ITEM,String ANNC_ID)throws Exception{
		try{
			String ITEM_ID=Util.ReturnCode();
			String SYMBOL=null;
			String DEPICT=null;
			String SHOW_ORDER=null;
			SYMBOL=getValue(DM_PR_ANNC_ITEM.element("SYMBOL"),"SYMBOL",SYMBOL);
			DEPICT=getValue(DM_PR_ANNC_ITEM.element("DEPICT"),"DEPICT",DEPICT);
			SHOW_ORDER=getValue(DM_PR_ANNC_ITEM.element("SHOW_ORDER"),"SHOW_ORDER",SHOW_ORDER);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_PR_ANNC_ITEM where ANNC_ID="+ANNC_ID+" and SHOW_ORDER='"+SHOW_ORDER+"'");
			if(list!=null&&list.size()>0){
				sql="update DM_PR_ANNC_ITEM set SYMBOL="+getStringValue(SYMBOL)+",DEPICT="+getStringValue(DEPICT)+" where ANNC_ID="+ANNC_ID+" and SHOW_ORDER='"+SHOW_ORDER+"'";
			}else{
				sql="insert into DM_PR_ANNC_ITEM(ITEM_ID,ANNC_ID,SYMBOL,DEPICT,SHOW_ORDER)" +
						"Values" +
						"("+ITEM_ID+","+ANNC_ID+","+getStringValue(SYMBOL)+","+getStringValue(DEPICT)+","+SHOW_ORDER+")";
				
			}
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				sql="insert into DM_PR_ANNC_ITEM_bak(ITEM_ID,ANNC_ID,SYMBOL,DEPICT,SHOW_ORDER)" +
				"Values" +
				"("+getStringValue(ITEM_ID)+","+getStringValue(ANNC_ID)+","+getStringValue(SYMBOL)+","+getStringValue(DEPICT)+","+getStringValue(SHOW_ORDER)+")";
				ebean.update_sql(sql);
				return;
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void biaozhun_parserXml4(Element DM_PR_ANNC_MODULE)throws Exception{
		try{
			String ANNC_ID=null;
			String ANNC_NAME=null;
			String DEPICT=null;
			String STATUS=null;
			String FCU=null;
			ANNC_ID=getValue(DM_PR_ANNC_MODULE.element("ANNC_ID"),"ANNC_ID",ANNC_ID);
			ANNC_NAME=getValue(DM_PR_ANNC_MODULE.element("ANNC_NAME"),"ANNC_NAME",ANNC_NAME);
			DEPICT=getValue(DM_PR_ANNC_MODULE.element("DEPICT"),"DEPICT",DEPICT);
			STATUS=getValue(DM_PR_ANNC_MODULE.element("STATUS"),"STATUS",STATUS);
			FCU=getValue(DM_PR_ANNC_MODULE.element("FCU"),"FCU",FCU);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_PR_ANNC_MODULE where ANNC_ID='"+ANNC_ID+"'");
			if(list!=null&&list.size()>0){
				sql="update DM_PR_ANNC_MODULE set ANNC_NAME="+getStringValue(ANNC_NAME)+",DEPICT="+getStringValue(DEPICT)+",STATUS="+STATUS+",FCD=sysdate,FCU="+FCU+" where ANNC_ID='"+ANNC_ID+"'";
			}else{
				sql="insert into DM_PR_ANNC_MODULE(ANNC_ID,ANNC_NAME,DEPICT,STATUS,FCD,FCU)" +
						"Values" +
						"("+ANNC_ID+","+getStringValue(ANNC_NAME)+","+getStringValue(DEPICT)+","+STATUS+",sysdate,"+FCU+")";

			}	
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				sql="insert into DM_PR_ANNC_MODULE_bak(ANNC_ID,ANNC_NAME,DEPICT,STATUS,FCD,FCU)" +
				"Values" +
				"("+getStringValue(ANNC_ID)+","+getStringValue(ANNC_NAME)+","+getStringValue(DEPICT)+","+getStringValue(STATUS)+",'sysdate',"+getStringValue(FCU)+")";
				ebean.update_sql(sql);
				return;
			}
			Iterator iters1=DM_PR_ANNC_MODULE.elementIterator();
			while(iters1.hasNext()){
				Element DM_PR_ANNC_ITEM=(Element)iters1.next();
				if(DM_PR_ANNC_ITEM.getName().equals("DM_PR_ANNC_ITEM")){
					biaozhun_parserXml5(DM_PR_ANNC_ITEM,ANNC_ID);
				}
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void biaozhun_parserXml3(Element DM_PR_BLUE_BALE_COVER_Element,String BALE_ID)throws Exception{
		try{
			String COVER_ID=Util.ReturnCode();
			String COVER_DESC=null;
			String AMOUNT=null;
			String CAMOUNT=null;
			String SHOW_CATE=null;
			String SHOW_ORDER=null;
			COVER_DESC=getValue(DM_PR_BLUE_BALE_COVER_Element.element("COVER_DESC"),"COVER_DESC",COVER_DESC);
			AMOUNT=getValue(DM_PR_BLUE_BALE_COVER_Element.element("AMOUNT"),"AMOUNT",AMOUNT);
			CAMOUNT=getValue(DM_PR_BLUE_BALE_COVER_Element.element("CAMOUNT"),"CAMOUNT",CAMOUNT);
			SHOW_CATE=getValue(DM_PR_BLUE_BALE_COVER_Element.element("SHOW_CATE"),"SHOW_CATE",SHOW_CATE);
			SHOW_ORDER=getValue(DM_PR_BLUE_BALE_COVER_Element.element("SHOW_ORDER"),"SHOW_ORDER",SHOW_ORDER);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_PR_BLUE_BALE_COVER where BALE_ID="+BALE_ID+" and SHOW_ORDER='"+SHOW_ORDER+"'");
			if(list!=null&&list.size()>0){
				sql="update DM_PR_BLUE_BALE_COVER set COVER_DESC="+getStringValue(COVER_DESC)+",AMOUNT="+AMOUNT+",CAMOUNT="+getStringValue(CAMOUNT)+",SHOW_CATE="+SHOW_CATE+" where BALE_ID="+BALE_ID+" and SHOW_ORDER='"+SHOW_ORDER+"'";
			}else{
				sql="insert into DM_PR_BLUE_BALE_COVER(COVER_ID,BALE_ID,COVER_DESC,AMOUNT,CAMOUNT,SHOW_CATE,SHOW_ORDER)" +
						"Values" +
						"("+COVER_ID+","+BALE_ID+","+getStringValue(COVER_DESC)+","+AMOUNT+","+getStringValue(CAMOUNT)+","+SHOW_CATE+","+SHOW_ORDER+")";
				
			}		
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				sql="insert into DM_PR_BLUE_BALE_COVER_bak(COVER_ID,BALE_ID,COVER_DESC,AMOUNT,CAMOUNT,SHOW_CATE,SHOW_ORDER)" +
				"Values" +
				"("+getStringValue(COVER_ID)+","+getStringValue(BALE_ID)+","+getStringValue(COVER_DESC)+","+getStringValue(AMOUNT)+"," +
						""+getStringValue(CAMOUNT)+","+getStringValue(SHOW_CATE)+","+getStringValue(SHOW_ORDER)+")";
		
				ebean.update_sql(sql);
				return;
			}
		}catch(Exception e){
			
		}
	}
	private void biaozhun_parserXml2(Element DM_PR_BLUE_BALE_PLAN_Element,String BLUE_ID)throws Exception{
		try{
			String BALE_PLAN_ID=Util.ReturnCode();
			String PLAN_SEQ=null;
			String BASIC_RIDER=null;
			String UNIT=null;
			String AMOUNT=null;
			String PREMIUM=null;
			String COVER_LEVEL=null;
			String CHARGE_FREQ=null;
			String CHARGE_TYPE=null;
			String CHARGE_YEAR=null;
			String COVER_TYPE=null;
			String COVER_YEAR=null;
			String DRAW_FREQ=null;
			String DRAW_FST_TYPE=null;
			String DRAW_FST_YEAR=null;
			String DRAW_LST_TYPE=null;
			String DRAW_LST_YEAR=null;
			String DRAW_ENSURE=null;
			String COUNT_WAY=null;
			String PACK_CODE=null;
			String BONUS_DRAW=null;
			String PLAN_ID=null;
			PLAN_ID=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("PLAN_ID"),"PLAN_ID",PLAN_ID);
			PLAN_SEQ=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("PLAN_SEQ"),"PLAN_SEQ",PLAN_SEQ);
			BASIC_RIDER=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("BASIC_RIDER"),"BASIC_RIDER",BASIC_RIDER);
			UNIT=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("UNIT"),"UNIT",UNIT);
			AMOUNT=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("AMOUNT"),"AMOUNT",AMOUNT);
			PREMIUM=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("PREMIUM"),"PREMIUM",PREMIUM);
			COVER_LEVEL=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("COVER_LEVEL"),"COVER_LEVEL",COVER_LEVEL);
			CHARGE_FREQ=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("CHARGE_FREQ"),"CHARGE_FREQ",CHARGE_FREQ);
			CHARGE_TYPE=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("CHARGE_TYPE"),"CHARGE_TYPE",CHARGE_TYPE);
			CHARGE_YEAR=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("CHARGE_YEAR"),"CHARGE_YEAR",CHARGE_YEAR);
			COVER_TYPE=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("COVER_TYPE"),"COVER_TYPE",COVER_TYPE);
			COVER_YEAR=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("COVER_YEAR"),"COVER_YEAR",COVER_YEAR);
			DRAW_FREQ=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("DRAW_FREQ"),"DRAW_FREQ",DRAW_FREQ);
			DRAW_FST_TYPE=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("DRAW_FST_TYPE"),"DRAW_FST_TYPE",DRAW_FST_TYPE);
			DRAW_FST_YEAR=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("DRAW_FST_YEAR"),"DRAW_FST_YEAR",DRAW_FST_YEAR);
			DRAW_LST_TYPE=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("DRAW_LST_TYPE"),"DRAW_LST_TYPE",DRAW_LST_TYPE);
			DRAW_LST_YEAR=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("DRAW_LST_YEAR"),"DRAW_LST_YEAR",DRAW_LST_YEAR);
			DRAW_ENSURE=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("DRAW_ENSURE"),"DRAW_ENSURE",DRAW_ENSURE);
			COUNT_WAY=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("COUNT_WAY"),"COUNT_WAY",COUNT_WAY);
			PACK_CODE=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("PACK_CODE"),"PACK_CODE",PACK_CODE);
			BONUS_DRAW=getValue(DM_PR_BLUE_BALE_PLAN_Element.element("BONUS_DRAW"),"BONUS_DRAW",BONUS_DRAW);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_PR_BLUE_BALE_PLAN where BALE_ID="+BLUE_ID+" and PLAN_ID="+PLAN_ID);
			if(list!=null&&list.size()>0){
				sql="update DM_PR_BLUE_BALE_PLAN set BASIC_RIDER="+BASIC_RIDER+",UNIT="+UNIT+",AMOUNT="+AMOUNT+",PREMIUM="+PREMIUM+",COVER_LEVEL="+getStringValue(COVER_LEVEL)+"," +
						"CHARGE_FREQ="+CHARGE_FREQ+",CHARGE_TYPE="+CHARGE_TYPE+",CHARGE_YEAR="+CHARGE_YEAR+",COVER_TYPE="+COVER_TYPE+",COVER_YEAR="+COVER_YEAR+",DRAW_FREQ="+DRAW_FREQ+"," +
								"DRAW_FST_TYPE="+DRAW_FST_TYPE+",DRAW_FST_YEAR="+DRAW_FST_YEAR+",DRAW_LST_TYPE="+DRAW_LST_TYPE+",DRAW_LST_YEAR="+DRAW_LST_YEAR+"," +
										"DRAW_ENSURE="+DRAW_ENSURE+",COUNT_WAY="+COUNT_WAY+",PACK_CODE="+getStringValue(PACK_CODE)+",BONUS_DRAW="+BONUS_DRAW+" where BALE_ID="+BLUE_ID+" and PLAN_ID="+PLAN_ID;
			}else{
				 sql="insert into DM_PR_BLUE_BALE_PLAN(BALE_PLAN_ID,BALE_ID,PLAN_ID,PLAN_SEQ,BASIC_RIDER,UNIT,AMOUNT,PREMIUM,COVER_LEVEL," +
				 		"CHARGE_FREQ,CHARGE_TYPE,CHARGE_YEAR,COVER_TYPE,COVER_YEAR,DRAW_FREQ,DRAW_FST_TYPE,DRAW_FST_YEAR,DRAW_LST_TYPE,DRAW_LST_YEAR," +
				 		"DRAW_ENSURE,COUNT_WAY,PACK_CODE,BONUS_DRAW)" +
					"Values" +
					"("+BALE_PLAN_ID+","+BLUE_ID+","+PLAN_ID+","+PLAN_SEQ+","+BASIC_RIDER+","+UNIT+","+AMOUNT+","+PREMIUM+","+getStringValue(COVER_LEVEL)+"," +
							""+CHARGE_FREQ+","+CHARGE_TYPE+","+CHARGE_YEAR+","+COVER_TYPE+","+COVER_YEAR+","+DRAW_FREQ+","+DRAW_FST_TYPE+","+DRAW_FST_YEAR+"," +
									""+DRAW_LST_TYPE+","+DRAW_LST_YEAR+","+DRAW_ENSURE+","+COUNT_WAY+","+getStringValue(PACK_CODE)+","+BONUS_DRAW+")";
			
			}
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				 sql="insert into DM_PR_BLUE_BALE_PLAN_bak(BALE_PLAN_ID,BALE_ID,PLAN_ID,PLAN_SEQ,BASIC_RIDER,UNIT,AMOUNT,PREMIUM,COVER_LEVEL," +
			 		"CHARGE_FREQ,CHARGE_TYPE,CHARGE_YEAR,COVER_TYPE,COVER_YEAR,DRAW_FREQ,DRAW_FST_TYPE,DRAW_FST_YEAR,DRAW_LST_TYPE,DRAW_LST_YEAR," +
			 		"DRAW_ENSURE,COUNT_WAY,PACK_CODE,BONUS_DRAW)" +
				"Values" +
				"("+getStringValue(BALE_PLAN_ID)+","+getStringValue(BLUE_ID)+","+getStringValue(PLAN_ID)+","+getStringValue(PLAN_SEQ)+"," +
						""+getStringValue(BASIC_RIDER)+","+getStringValue(UNIT)+","+getStringValue(AMOUNT)+","+getStringValue(PREMIUM)+"," +
								""+getStringValue(COVER_LEVEL)+"," +
						""+getStringValue(CHARGE_FREQ)+","+getStringValue(CHARGE_TYPE)+","+getStringValue(CHARGE_YEAR)+","+getStringValue(COVER_TYPE)+"," +
								""+getStringValue(COVER_YEAR)+","+getStringValue(DRAW_FREQ)+","+getStringValue(DRAW_FST_TYPE)+"," +
										""+getStringValue(DRAW_FST_YEAR)+"," +
								""+getStringValue(DRAW_LST_TYPE)+","+getStringValue(DRAW_LST_YEAR)+","+getStringValue(DRAW_ENSURE)+"," +
										""+getStringValue(COUNT_WAY)+","+getStringValue(PACK_CODE)+","+getStringValue(BONUS_DRAW)+")";

				ebean.update_sql(sql);
				return;
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
		
	}
	private void biaozhun_parserXml1(Element DM_PR_BLUE_BALE_Element,String BLUE_ID)throws Exception{
		try{
			String BALE_ID=Util.ReturnCode();
			String BALE_NO=null;
			String BALE_NAME=null;
			String BALE_SHOW=null;
			String POLICY_TYPE=null;
			String DEPICT=null;
			String SELL_WAY=null;
			String OCCUP_CODE=null;
			String ANNC_ID=null;
			String CONSTRUCT=null;
			String EFF_DATE=null;
			String INEFF_DATE=null;
			String BALE_CATE=null;
			String STATUS=null;
			String FCU=null;
			String ARTICLE_ID=null;
			BALE_NO=getValue(DM_PR_BLUE_BALE_Element.element("BALE_NO"),"BALE_NO",BALE_NO);
			BALE_NAME=getValue(DM_PR_BLUE_BALE_Element.element("BALE_NAME"),"BALE_NAME",BALE_NAME);
			BALE_SHOW=getValue(DM_PR_BLUE_BALE_Element.element("BALE_SHOW"),"BALE_SHOW",BALE_SHOW);
			POLICY_TYPE=getValue(DM_PR_BLUE_BALE_Element.element("POLICY_TYPE"),"POLICY_TYPE",POLICY_TYPE);
			DEPICT=getValue(DM_PR_BLUE_BALE_Element.element("DEPICT"),"DEPICT",DEPICT);
			SELL_WAY=getValue(DM_PR_BLUE_BALE_Element.element("SELL_WAY"),"SELL_WAY",SELL_WAY);
			OCCUP_CODE=getValue(DM_PR_BLUE_BALE_Element.element("OCCUP_CODE"),"OCCUP_CODE",OCCUP_CODE);
			ANNC_ID=getValue(DM_PR_BLUE_BALE_Element.element("ANNC_ID"),"ANNC_ID",ANNC_ID);
			CONSTRUCT=getValue(DM_PR_BLUE_BALE_Element.element("CONSTRUCT"),"CONSTRUCT",CONSTRUCT);
			EFF_DATE=getValue(DM_PR_BLUE_BALE_Element.element("EFF_DATE"),"EFF_DATE",EFF_DATE);
			INEFF_DATE=getValue(DM_PR_BLUE_BALE_Element.element("INEFF_DATE"),"INEFF_DATE",INEFF_DATE);
			BALE_CATE=getValue(DM_PR_BLUE_BALE_Element.element("BALE_CATE"),"BALE_CATE",BALE_CATE);
			STATUS=getValue(DM_PR_BLUE_BALE_Element.element("STATUS"),"STATUS",STATUS);
			if(STATUS==null||STATUS.equals("")||STATUS.length()==0){
				STATUS="1";
			}
			FCU=getValue(DM_PR_BLUE_BALE_Element.element("FCU"),"FCU",FCU);
			ARTICLE_ID=getValue(DM_PR_BLUE_BALE_Element.element("ARTICLE_ID"),"ARTICLE_ID",ARTICLE_ID);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_PR_BLUE_BALE where BALE_NO='"+BALE_NO+"' and BLUE_ID='"+BLUE_ID+"'");
			if(list!=null&&list.size()>0){
				Map map=(Map)list.get(0);
				BigDecimal BALE_ID1=(BigDecimal)map.get("BALE_ID");
				BALE_ID=BALE_ID1.toString();
				sql="update DM_PR_BLUE_BALE set BALE_NAME="+getStringValue(BALE_NAME)+",BALE_SHOW="+getStringValue(BALE_SHOW)+",DEPICT="+getStringValue(DEPICT)+",POLICY_TYPE="+POLICY_TYPE+"," +
						"SELL_WAY="+SELL_WAY+",OCCUP_CODE="+getStringValue(OCCUP_CODE)+",ANNC_ID="+ANNC_ID+",CONSTRUCT="+getStringValue(CONSTRUCT)+"," +
								"EFF_DATE="+getDateValue(EFF_DATE)+",INEFF_DATE="+getDateValue(INEFF_DATE)+",BALE_CATE="+BALE_CATE+",STATUS="+STATUS+"," +
										"FCD=sysdate,FCU="+FCU+",ARTICLE_ID="+ARTICLE_ID+" where BALE_NO='"+BALE_NO+"'";
			}else{
				sql="insert into DM_PR_BLUE_BALE(BALE_ID,BLUE_ID,BALE_NO,BALE_NAME,BALE_SHOW,DEPICT,POLICY_TYPE," +
						"SELL_WAY,OCCUP_CODE,ANNC_ID,CONSTRUCT,EFF_DATE,INEFF_DATE,BALE_CATE,STATUS,FCD,FCU,ARTICLE_ID)" +
				"Values("+BALE_ID+","+BLUE_ID+","+getStringValue(BALE_NO)+","+getStringValue(BALE_NAME)+"," +
						""+getStringValue(BALE_SHOW)+","+getStringValue(DEPICT)+","+POLICY_TYPE+","+SELL_WAY+","+getStringValue(OCCUP_CODE)+"," +
								""+ANNC_ID+","+getStringValue(CONSTRUCT)+","+getDateValue(EFF_DATE)+","+getDateValue(INEFF_DATE)+","+BALE_CATE+"," +
										""+STATUS+",sysdate,"+FCU+","+ARTICLE_ID+")";
	
			}
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				sql="insert into DM_PR_BLUE_BALE_bak(BALE_ID,BLUE_ID,BALE_NO,BALE_NAME,BALE_SHOW,DEPICT,POLICY_TYPE," +
				"SELL_WAY,OCCUP_CODE,ANNC_ID,CONSTRUCT,EFF_DATE,INEFF_DATE,BALE_CATE,STATUS,FCD,FCU,ARTICLE_ID)" +
		"Values("+getStringValue(BALE_ID)+","+getStringValue(BLUE_ID)+","+getStringValue(BALE_NO)+","+getStringValue(BALE_NAME)+"," +
				""+getStringValue(BALE_SHOW)+","+getStringValue(DEPICT)+","+getStringValue(POLICY_TYPE)+","+getStringValue(SELL_WAY)+","+getStringValue(OCCUP_CODE)+"," +
						""+getStringValue(ANNC_ID)+","+getStringValue(CONSTRUCT)+","+getStringValue(EFF_DATE)+","+getStringValue(INEFF_DATE)+"," +
								""+getStringValue(BALE_CATE)+"," +
								""+getStringValue(STATUS)+",'sysdate',"+getStringValue(FCU)+","+getStringValue(ARTICLE_ID)+")";
				ebean.update_sql(sql);
				return;
			}
			Iterator iters1=DM_PR_BLUE_BALE_Element.elementIterator();
			while(iters1.hasNext()){
				Element DM_PR_BLUE_BALE_PLAN_Element=(Element)iters1.next();
				if(DM_PR_BLUE_BALE_PLAN_Element.getName().equals("DM_PR_BLUE_BALE_PLAN")){
					biaozhun_parserXml2(DM_PR_BLUE_BALE_PLAN_Element,BALE_ID);
				}else if(DM_PR_BLUE_BALE_PLAN_Element.getName().equals("DM_PR_BLUE_BALE_COVER")){
					biaozhun_parserXml3(DM_PR_BLUE_BALE_PLAN_Element,BALE_ID);
				}else if(DM_PR_BLUE_BALE_PLAN_Element.getName().equals("DM_PR_ANNC_MODULE")){
					biaozhun_parserXml4(DM_PR_BLUE_BALE_PLAN_Element);
				}
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void yingxiao_parserXml4(Element DM_ANNOUNCE_ITEM,String ANNC_ID)throws Exception{
		try{
			String ITEM_ID=Util.ReturnCode();
			String SYMBOL=null;
			String DEPICT=null;
			String SHOW_ORDER=null;
			SYMBOL=getValue(DM_ANNOUNCE_ITEM.element("SYMBOL"),"SYMBOL",SYMBOL);
			DEPICT=getValue(DM_ANNOUNCE_ITEM.element("DEPICT"),"DEPICT",DEPICT);
			SHOW_ORDER=getValue(DM_ANNOUNCE_ITEM.element("SHOW_ORDER"),"SHOW_ORDER",SHOW_ORDER);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_ANNOUNCE_ITEM where ANNC_ID="+ANNC_ID+" and SHOW_ORDER="+SHOW_ORDER);
			if(list!=null&&list.size()>0){
				sql="update DM_ANNOUNCE_ITEM set SYMBOL="+getStringValue(SYMBOL)+",DEPICT="+getStringValue(DEPICT)+" where ANNC_ID="+ITEM_ID+" and SHOW_ORDER="+SHOW_ORDER;
			}else{
				sql="insert into DM_ANNOUNCE_ITEM(ITEM_ID,ANNC_ID,SYMBOL,DEPICT,SHOW_ORDER)Values("+ITEM_ID+","+ANNC_ID+","+getStringValue(SYMBOL)+","+getStringValue(DEPICT)+","+SHOW_ORDER+")";	
				
			}
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				sql="insert into DM_ANNOUNCE_ITEM_bak(ITEM_ID,ANNC_ID,SYMBOL,DEPICT,SHOW_ORDER)Values("+getStringValue(ITEM_ID)+","+getStringValue(ANNC_ID)+"," +
				""+getStringValue(SYMBOL)+","+getStringValue(DEPICT)+","+getStringValue(SHOW_ORDER)+")";	
				log.error(Util.getERRO(e));
				ebean.update_sql(sql);
				return;
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void yingxiao_parserXml3(Element DM_ANNOUNCE_MODULE)throws Exception{
		try{
			String ANNC_ID=null;
			String ANNC_NAME=null;
			String DEPICT=null;
			ANNC_ID=getValue(DM_ANNOUNCE_MODULE.element("ANNC_ID"),"ANNC_ID",ANNC_ID);
			ANNC_NAME=getValue(DM_ANNOUNCE_MODULE.element("ANNC_NAME"),"ANNC_NAME",ANNC_NAME);
			DEPICT=getValue(DM_ANNOUNCE_MODULE.element("DEPICT"),"DEPICT",DEPICT);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_ANNOUNCE_MODULE where ANNC_ID='"+ANNC_ID+"'");
			if(list!=null&&list.size()>0){
				sql="update DM_ANNOUNCE_MODULE set ANNC_NAME="+getStringValue(ANNC_NAME)+",DEPICT="+getStringValue(DEPICT)+" where  ANNC_ID='"+ANNC_ID+"'";

			}else{
				sql="insert into DM_ANNOUNCE_MODULE(ANNC_ID,ANNC_NAME,DEPICT)Values('"+ANNC_ID+"',"+getStringValue(ANNC_NAME)+","+getStringValue(DEPICT)+")";

			}	
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				sql="insert into DM_ANNOUNCE_MODULE_bak(ANNC_ID,ANNC_NAME,DEPICT)Values('"+getStringValue(ANNC_ID)+"',"+getStringValue(ANNC_NAME)+","+getStringValue(DEPICT)+")";
				ebean.update_sql(sql);
				return;
			}
			Iterator iters1=DM_ANNOUNCE_MODULE.elementIterator();
			while(iters1.hasNext()){
				Element DM_ANNOUNCE_ITEM=(Element)iters1.next();
				if(DM_ANNOUNCE_ITEM.getName().equals("DM_ANNOUNCE_ITEM")){
					yingxiao_parserXml4(DM_ANNOUNCE_ITEM,ANNC_ID);
				}
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void yingxiao_parserXml2(Element DM_BLUEPRINT_BALE,String BLUE_ID,String BLUE_CODE)throws Exception{
		try{
			String BALE_ID=Util.ReturnCode();
			String BALE_NO=null;
			String BALE_NAME=null;
			String BALE_SHOW=null;
			String DEPICT=null;
			String SELL_WAY=null;
			String PRINT_MODE=null;
			String OCCUP_CODE=null;
			String CALL_TYPE=null;
			String ANNC_ID=null;
			String CONSTRUCT=null;
			String EFF_DATE=null;
			String INEFF_DATE=null;
			String POLICY_TYPE=null;
			String BE_FREE="0";
			String PR_BALE_ID=null;
			String PR_BLUE_CODE=null;
			String PR_BALE_NO=null;
			String STATUS="1";
			String PRINT_MODE_APP="1";
			String PRINT_MODE_POL="1";
			String PRINT_MODE_RCPT="1";
			String PRINT_MODE_EPOL="0";
			String POL_EFF_DATE=null;
			String CHARGE_LIST="5,1";
			String SYS_DEALING=null;
			String SYS_EVENT_CLERK=null;
			String SYS_EVENT_TIME=null;
			String PRINT_MODE_AUTH="0";
			String INVEST_ACC_TYPE=null;
			String BALE_ATT_INFO=null;
			String PRINT_RCPT_TRAN="1";
			String PRINT_RCPT_CRED="1";
			String PRINT_MODE_RETURN="0";
			String ADD_FREE_MEMO="0";
			String PROD_CODE=null;
			PR_BALE_NO=getValue(DM_BLUEPRINT_BALE.element("PR_BALE_NO"),"PR_BALE_NO",PR_BALE_NO);
			PR_BLUE_CODE=getValue(DM_BLUEPRINT_BALE.element("PR_BLUE_CODE"),"PR_BLUE_CODE",PR_BLUE_CODE);
			BALE_NO=getValue(DM_BLUEPRINT_BALE.element("BALE_NO"),"BALE_NO",BALE_NO);
			BALE_NAME=getValue(DM_BLUEPRINT_BALE.element("BALE_NAME"),"BALE_NAME",BALE_NAME);
			BALE_SHOW=getValue(DM_BLUEPRINT_BALE.element("BALE_SHOW"),"BALE_SHOW",BALE_SHOW);
			DEPICT=getValue(DM_BLUEPRINT_BALE.element("DEPICT"),"DEPICT",DEPICT);
			SELL_WAY=getValue(DM_BLUEPRINT_BALE.element("SELL_WAY"),"SELL_WAY",SELL_WAY);
			PRINT_MODE=getValue(DM_BLUEPRINT_BALE.element("PRINT_MODE"),"PRINT_MODE",PRINT_MODE);
			OCCUP_CODE=getValue(DM_BLUEPRINT_BALE.element("OCCUP_CODE"),"OCCUP_CODE",OCCUP_CODE);
			CALL_TYPE=getValue(DM_BLUEPRINT_BALE.element("CALL_TYPE"),"CALL_TYPE",CALL_TYPE);
			ANNC_ID=getValue(DM_BLUEPRINT_BALE.element("ANNC_ID"),"ANNC_ID",ANNC_ID);
			CONSTRUCT=getValue(DM_BLUEPRINT_BALE.element("CONSTRUCT"),"CONSTRUCT",CONSTRUCT);
			EFF_DATE=getValue(DM_BLUEPRINT_BALE.element("EFF_DATE"),"EFF_DATE",EFF_DATE);
			INEFF_DATE=getValue(DM_BLUEPRINT_BALE.element("INEFF_DATE"),"INEFF_DATE",INEFF_DATE);
			POLICY_TYPE=getValue(DM_BLUEPRINT_BALE.element("POLICY_TYPE"),"POLICY_TYPE",POLICY_TYPE);
			BE_FREE=getValue(DM_BLUEPRINT_BALE.element("BE_FREE"),"BE_FREE",BE_FREE);
			STATUS=getValue(DM_BLUEPRINT_BALE.element("STATUS"),"STATUS",STATUS);
			PRINT_MODE_APP=getValue(DM_BLUEPRINT_BALE.element("PRINT_MODE_APP"),"PRINT_MODE_APP",PRINT_MODE_APP);
			PRINT_MODE_POL=getValue(DM_BLUEPRINT_BALE.element("PRINT_MODE_POL"),"PRINT_MODE_POL",PRINT_MODE_POL);
			PRINT_MODE_RCPT=getValue(DM_BLUEPRINT_BALE.element("PRINT_MODE_RCPT"),"PRINT_MODE_RCPT",PRINT_MODE_RCPT);
			PRINT_MODE_EPOL=getValue(DM_BLUEPRINT_BALE.element("PRINT_MODE_EPOL"),"PRINT_MODE_EPOL",PRINT_MODE_EPOL);
			POL_EFF_DATE=getValue(DM_BLUEPRINT_BALE.element("POL_EFF_DATE"),"POL_EFF_DATE",POL_EFF_DATE);
			CHARGE_LIST=getValue(DM_BLUEPRINT_BALE.element("CHARGE_LIST"),"CHARGE_LIST",CHARGE_LIST);
			SYS_DEALING=getValue(DM_BLUEPRINT_BALE.element("SYS_DEALING"),"SYS_DEALING",SYS_DEALING);
			SYS_EVENT_CLERK=getValue(DM_BLUEPRINT_BALE.element("SYS_EVENT_CLERK"),"SYS_EVENT_CLERK",SYS_EVENT_CLERK);
			SYS_EVENT_TIME=getValue(DM_BLUEPRINT_BALE.element("SYS_EVENT_TIME"),"SYS_EVENT_TIME",SYS_EVENT_TIME);
			PRINT_MODE_AUTH=getValue(DM_BLUEPRINT_BALE.element("PRINT_MODE_AUTH"),"PRINT_MODE_AUTH",PRINT_MODE_AUTH);
			INVEST_ACC_TYPE=getValue(DM_BLUEPRINT_BALE.element("INVEST_ACC_TYPE"),"INVEST_ACC_TYPE",INVEST_ACC_TYPE);
			BALE_ATT_INFO=getValue(DM_BLUEPRINT_BALE.element("BALE_ATT_INFO"),"BALE_ATT_INFO",BALE_ATT_INFO);
			PRINT_RCPT_TRAN=getValue(DM_BLUEPRINT_BALE.element("PRINT_RCPT_TRAN"),"PRINT_RCPT_TRAN",PRINT_RCPT_TRAN);
			PRINT_RCPT_CRED=getValue(DM_BLUEPRINT_BALE.element("PRINT_RCPT_CRED"),"PRINT_RCPT_CRED",PRINT_RCPT_CRED);
			PRINT_MODE_RETURN=getValue(DM_BLUEPRINT_BALE.element("PRINT_MODE_RETURN"),"PRINT_MODE_RETURN",PRINT_MODE_RETURN);
			ADD_FREE_MEMO=getValue(DM_BLUEPRINT_BALE.element("ADD_FREE_MEMO"),"ADD_FREE_MEMO",ADD_FREE_MEMO);
			PROD_CODE=getValue(DM_BLUEPRINT_BALE.element("PROD_CODE"),"PROD_CODE",PROD_CODE);
			String sql="";
			try{
				PR_BALE_ID=ebean.chaxunString("select tb2.bale_id from dm_pr_blueprint tb,dm_pr_blue_bale tb2 " +
						"where tb.blue_id = tb2.blue_id and tb.blue_code = '"+PR_BLUE_CODE+"' and tb2.bale_no = '"+PR_BALE_NO+"'");
			}catch(Exception e){
				log.error(Util.getERRO(e));
				 sql="insert into DM_BLUEPRINT_BALE_bak(BALE_ID,BLUE_ID,BALE_NO,BALE_NAME,BALE_SHOW,DEPICT,SELL_WAY,PRINT_MODE,OCCUP_CODE,CALL_TYPE,ANNC_ID," +
			 		"CONSTRUCT,EFF_DATE,INEFF_DATE,POLICY_TYPE,BE_FREE,PR_BALE_ID,STATUS,PRINT_MODE_APP,PRINT_MODE_POL,PRINT_MODE_RCPT,PRINT_MODE_EPOL," +
			 		"POL_EFF_DATE,CHARGE_LIST,SYS_DEALING,SYS_EVENT_CLERK,SYS_EVENT_TIME,PRINT_MODE_AUTH,INVEST_ACC_TYPE,BALE_ATT_INFO,PRINT_RCPT_TRAN," +
			 		"PRINT_RCPT_CRED,PRINT_MODE_RETURN,ADD_FREE_MEMO,PROD_CODE)" +
				"Values" +
				"("+getStringValue(BALE_ID)+","+getStringValue(BLUE_ID)+","+getStringValue(BALE_NO)+","+getStringValue(BALE_NAME)+"," +
						""+getStringValue(BALE_SHOW)+","+getStringValue(DEPICT)+"," +
						""+getStringValue(SELL_WAY)+","+getStringValue(PRINT_MODE)+","+getStringValue(OCCUP_CODE)+","+getStringValue(CALL_TYPE)+"," +
								""+getStringValue(ANNC_ID)+","+getStringValue(CONSTRUCT)+"," +
								""+getStringValue(EFF_DATE)+","+getStringValue(INEFF_DATE)+","+getStringValue(POLICY_TYPE)+","+getStringValue(BE_FREE)+"," +
										""+getStringValue(PR_BALE_ID)+","+getStringValue(STATUS)+"," +
										""+getStringValue(PRINT_MODE_APP)+","+getStringValue(PRINT_MODE_POL)+","+getStringValue(PRINT_MODE_RCPT)+"," +
												""+getStringValue(PRINT_MODE_EPOL)+","+getStringValue(POL_EFF_DATE)+"," +
												""+getStringValue(CHARGE_LIST)+","+getStringValue(SYS_DEALING)+","+getStringValue(SYS_EVENT_CLERK)+"," +
														""+getDateValue(SYS_EVENT_TIME)+","+PRINT_MODE_AUTH+","+INVEST_ACC_TYPE+"," +
																""+getStringValue(BALE_ATT_INFO)+","+getStringValue(PRINT_RCPT_TRAN)+"," +
																		""+getStringValue(PRINT_RCPT_CRED)+"," +
																		""+getStringValue(PRINT_MODE_RETURN)+","+getStringValue(ADD_FREE_MEMO)+"," +
																				""+getStringValue(PROD_CODE)+")";
				ebean.update_sql(sql);
				return;
			}
			
			
			List list=ebean.chaxun_sql("select * from DM_BLUEPRINT_BALE where BALE_NO='"+BALE_NO+"' and BLUE_ID='"+BLUE_ID+"'");
			if(list!=null&&list.size()>0){
				sql="update DM_BLUEPRINT_BALE set BALE_NAME="+getStringValue(BALE_NAME)+",BALE_SHOW="+getStringValue(BALE_SHOW)+",DEPICT="+getStringValue(DEPICT)+"," +
						"SELL_WAY="+SELL_WAY+",PRINT_MODE="+PRINT_MODE+",OCCUP_CODE="+getStringValue(OCCUP_CODE)+",CALL_TYPE="+CALL_TYPE+",ANNC_ID="+ANNC_ID+",CONSTRUCT="+getStringValue(CONSTRUCT)+"," +
								"EFF_DATE="+getDateValue(EFF_DATE)+",INEFF_DATE="+getDateValue(INEFF_DATE)+",POLICY_TYPE="+POLICY_TYPE+",BE_FREE="+BE_FREE+",PR_BALE_ID="+PR_BALE_ID+",STATUS="+STATUS+"," +
										"PRINT_MODE_APP="+PRINT_MODE_APP+",PRINT_MODE_POL="+PRINT_MODE_POL+",PRINT_MODE_RCPT="+PRINT_MODE_RCPT+",PRINT_MODE_EPOL="+PRINT_MODE_EPOL+"," +
												"POL_EFF_DATE="+getDateValue(POL_EFF_DATE)+",CHARGE_LIST="+getStringValue(CHARGE_LIST)+",SYS_DEALING="+getStringValue(SYS_DEALING)+"," +
														"SYS_EVENT_CLERK="+SYS_EVENT_CLERK+",SYS_EVENT_TIME="+getDateValue(SYS_EVENT_TIME)+",PRINT_MODE_AUTH="+PRINT_MODE_AUTH+",INVEST_ACC_TYPE="+INVEST_ACC_TYPE+"," +
																"BALE_ATT_INFO="+getStringValue(BALE_ATT_INFO)+",PRINT_RCPT_TRAN="+PRINT_RCPT_TRAN+",PRINT_RCPT_CRED="+PRINT_RCPT_CRED+"," +
																		"PRINT_MODE_RETURN="+PRINT_MODE_RETURN+",ADD_FREE_MEMO="+ADD_FREE_MEMO+",PROD_CODE="+getStringValue(PROD_CODE)+" where BALE_NO='"+BALE_NO+"' and blue_id='"+BLUE_ID+"'";

			}else{
				 sql="insert into DM_BLUEPRINT_BALE(BALE_ID,BLUE_ID,BALE_NO,BALE_NAME,BALE_SHOW,DEPICT,SELL_WAY,PRINT_MODE,OCCUP_CODE,CALL_TYPE,ANNC_ID," +
				 		"CONSTRUCT,EFF_DATE,INEFF_DATE,POLICY_TYPE,BE_FREE,PR_BALE_ID,STATUS,PRINT_MODE_APP,PRINT_MODE_POL,PRINT_MODE_RCPT,PRINT_MODE_EPOL," +
				 		"POL_EFF_DATE,CHARGE_LIST,SYS_DEALING,SYS_EVENT_CLERK,SYS_EVENT_TIME,PRINT_MODE_AUTH,INVEST_ACC_TYPE,BALE_ATT_INFO,PRINT_RCPT_TRAN," +
				 		"PRINT_RCPT_CRED,PRINT_MODE_RETURN,ADD_FREE_MEMO,PROD_CODE)" +
					"Values" +
					"("+BALE_ID+","+BLUE_ID+","+getStringValue(BALE_NO)+","+getStringValue(BALE_NAME)+","+getStringValue(BALE_SHOW)+","+getStringValue(DEPICT)+"," +
							""+SELL_WAY+","+PRINT_MODE+","+getStringValue(OCCUP_CODE)+","+CALL_TYPE+","+ANNC_ID+","+getStringValue(CONSTRUCT)+"," +
									""+getDateValue(EFF_DATE)+","+getDateValue(INEFF_DATE)+","+POLICY_TYPE+","+BE_FREE+","+PR_BALE_ID+","+STATUS+"," +
											""+PRINT_MODE_APP+","+PRINT_MODE_POL+","+PRINT_MODE_RCPT+","+PRINT_MODE_EPOL+","+getDateValue(POL_EFF_DATE)+"," +
													""+getStringValue(CHARGE_LIST)+","+getStringValue(SYS_DEALING)+","+SYS_EVENT_CLERK+"," +
															""+getDateValue(SYS_EVENT_TIME)+","+PRINT_MODE_AUTH+","+INVEST_ACC_TYPE+"," +
																	""+getStringValue(BALE_ATT_INFO)+","+PRINT_RCPT_TRAN+","+PRINT_RCPT_CRED+"," +
																			""+PRINT_MODE_RETURN+","+ADD_FREE_MEMO+","+getStringValue(PROD_CODE)+")";
			
			}
			try{
				ebean.update_sql(sql);
			}catch(Exception e){
				log.error(Util.getERRO(e));
				 sql="insert into DM_BLUEPRINT_BALE_bak(BALE_ID,BLUE_ID,BALE_NO,BALE_NAME,BALE_SHOW,DEPICT,SELL_WAY,PRINT_MODE,OCCUP_CODE,CALL_TYPE,ANNC_ID," +
			 		"CONSTRUCT,EFF_DATE,INEFF_DATE,POLICY_TYPE,BE_FREE,PR_BALE_ID,STATUS,PRINT_MODE_APP,PRINT_MODE_POL,PRINT_MODE_RCPT,PRINT_MODE_EPOL," +
			 		"POL_EFF_DATE,CHARGE_LIST,SYS_DEALING,SYS_EVENT_CLERK,SYS_EVENT_TIME,PRINT_MODE_AUTH,INVEST_ACC_TYPE,BALE_ATT_INFO,PRINT_RCPT_TRAN," +
			 		"PRINT_RCPT_CRED,PRINT_MODE_RETURN,ADD_FREE_MEMO,PROD_CODE)" +
				"Values" +
				"("+getStringValue(BALE_ID)+","+getStringValue(BLUE_ID)+","+getStringValue(BALE_NO)+","+getStringValue(BALE_NAME)+"," +
						""+getStringValue(BALE_SHOW)+","+getStringValue(DEPICT)+"," +
						""+getStringValue(SELL_WAY)+","+getStringValue(PRINT_MODE)+","+getStringValue(OCCUP_CODE)+","+getStringValue(CALL_TYPE)+"," +
								""+getStringValue(ANNC_ID)+","+getStringValue(CONSTRUCT)+"," +
								""+getStringValue(EFF_DATE)+","+getStringValue(INEFF_DATE)+","+getStringValue(POLICY_TYPE)+","+getStringValue(BE_FREE)+"," +
										""+getStringValue(PR_BALE_ID)+","+getStringValue(STATUS)+"," +
										""+getStringValue(PRINT_MODE_APP)+","+getStringValue(PRINT_MODE_POL)+","+getStringValue(PRINT_MODE_RCPT)+"," +
												""+getStringValue(PRINT_MODE_EPOL)+","+getStringValue(POL_EFF_DATE)+"," +
												""+getStringValue(CHARGE_LIST)+","+getStringValue(SYS_DEALING)+","+getStringValue(SYS_EVENT_CLERK)+"," +
														""+getDateValue(SYS_EVENT_TIME)+","+PRINT_MODE_AUTH+","+INVEST_ACC_TYPE+"," +
																""+getStringValue(BALE_ATT_INFO)+","+getStringValue(PRINT_RCPT_TRAN)+"," +
																		""+getStringValue(PRINT_RCPT_CRED)+"," +
																		""+getStringValue(PRINT_MODE_RETURN)+","+getStringValue(ADD_FREE_MEMO)+"," +
																				""+getStringValue(PROD_CODE)+")";
				ebean.update_sql(sql);
				return;
			}
			
			Iterator iters1=DM_BLUEPRINT_BALE.elementIterator();
			while(iters1.hasNext()){
				Element DM_ANNOUNCE_MODULE=(Element)iters1.next();
				if(DM_ANNOUNCE_MODULE.getName().equals("DM_ANNOUNCE_MODULE")){
					yingxiao_parserXml3(DM_ANNOUNCE_MODULE);
				}
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
		
	}
	private void yingxiao_parserXml5(Element DM_BLUEPRINT_BILLNO,String BLUE_ID)throws Exception{
		try{
			String BLUE_BILLNO_ID=Util.ReturnCode();
			String BILL_TYPE=null;
			String BILLNO_FST=null;
			String BILLNO_LST=null;
			String BILLNO_CUR=null;
			String QUANTITY=null;
			String LCD=null;
			String POLICY_TYPE=null;
			BILL_TYPE=getValue(DM_BLUEPRINT_BILLNO.element("BILL_TYPE"),"BILL_TYPE",BILL_TYPE);
			BILLNO_FST=getValue(DM_BLUEPRINT_BILLNO.element("BILLNO_FST"),"BILLNO_FST",BILLNO_FST);
			BILLNO_LST=getValue(DM_BLUEPRINT_BILLNO.element("BILLNO_LST"),"BILLNO_LST",BILLNO_LST);
			BILLNO_CUR=getValue(DM_BLUEPRINT_BILLNO.element("BILLNO_CUR"),"BILLNO_CUR",BILLNO_CUR);
			QUANTITY=getValue(DM_BLUEPRINT_BILLNO.element("QUANTITY"),"QUANTITY",QUANTITY);
			LCD=getValue(DM_BLUEPRINT_BILLNO.element("LCD"),"LCD",LCD);
			POLICY_TYPE=getValue(DM_BLUEPRINT_BILLNO.element("POLICY_TYPE"),"POLICY_TYPE",POLICY_TYPE);
			String sql="";
			List list=ebean.chaxun_sql("select * from DM_BLUEPRINT_BILLNO where BLUE_ID='"+BLUE_ID+"' and BILLNO_FST="+BILLNO_FST+" and BILLNO_LST="+BILLNO_LST+" ");
			if(list!=null&&list.size()>0){
				
			}else{
				sql="insert into DM_BLUEPRINT_BILLNO(BLUE_BILLNO_ID,BLUE_ID,BILL_TYPE,BILLNO_FST,BILLNO_LST,BILLNO_CUR,QUANTITY,FCD,LCD,POLICY_TYPE)" +
				"Values" +
				"("+BLUE_BILLNO_ID+","+BLUE_ID+","+BILL_TYPE+","+BILLNO_FST+","+BILLNO_LST+","+BILLNO_CUR+","+QUANTITY+",sysdate,"+getDateValue(LCD)+","+POLICY_TYPE+")";
			
				try{
					ebean.update_sql(sql);
				}catch(Exception e){
					log.error(Util.getERRO(e));
					sql="insert into DM_BLUEPRINT_BILLNO_bak(BLUE_BILLNO_ID,BLUE_ID,BILL_TYPE,BILLNO_FST,BILLNO_LST,BILLNO_CUR,QUANTITY,FCD,LCD,POLICY_TYPE)" +
					"Values" +
					"("+getStringValue(BLUE_BILLNO_ID)+","+getStringValue(BLUE_ID)+","+getStringValue(BILL_TYPE)+","+getStringValue(BILLNO_FST)+"," +
							""+getStringValue(BILLNO_LST)+","+getStringValue(BILLNO_CUR)+","+getStringValue(QUANTITY)+",'sysdate'," +
									""+getStringValue(LCD)+","+getStringValue(POLICY_TYPE)+")";
				
					ebean.update_sql(sql);
					return;
				}
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void xieyi_parserXml(String xml)throws Exception{
		try{
			Document doc=DocumentHelper.parseText(xml); 
			Element root=doc.getRootElement();
			Iterator iters=root.elementIterator();
			Element DM_PARTNER=(Element)iters.next();
			Iterator iters1=DM_PARTNER.elementIterator();
			
			while(iters1.hasNext()){
				Element DM_AGREEMENT=(Element)iters1.next();
				if(DM_AGREEMENT.getName().equals("DM_AGREEMENT")){
					String AGREE_ID=Util.ReturnCode1(10);
					log.debug("AGREE_ID:"+AGREE_ID);
					String PARTNER_ID=Util.ReturnCode1(10);
					log.debug("PARTNER_ID:"+PARTNER_ID);
					String AGREE_CODE=null;
					String AGREE_NAME=null;
					String AGREE_ABBR=null;
					String ORGAN_ID=null;
					String EFF_DATE=null;
					String SHARE_CUST=null;
					String STATUS=null;
					String PRINT_LOGO=null;
					String HALL_CODE=null;
					String HALL_REMIND=null;
					String ONLINE_PAY=null;
					String RECORD_TRANS=null;
					String POS_TRANS=null;
					String TRADITION_MODE=null;
					
					String sql1=" select AGREE_ID,PARTNER_ID from DM_AGREEMENT where AGREE_CODE='"+AGREE_CODE+"'";
					List list=ebean.chaxun_sql(sql1);
					if(list!=null&&list.size()>0){
						log.info("DM_AGREEMENT 表中有值");
						Map map=(Map)list.get(0);
						AGREE_ID=(String)map.get("AGREE_ID");
						log.debug("AGREE_ID:"+AGREE_ID);
						PARTNER_ID=(String)map.get("PARTNER_ID");
						log.debug("PARTNER_ID:"+PARTNER_ID);
						String deleteSql=" delete from DM_AGREEMENT where AGREE_CODE='"+AGREE_CODE+"'";
						int deleteResult=ebean.update_sql(deleteSql);
						log.debug("deleteResult:"+deleteResult);
					}
					AGREE_CODE=getValue(DM_AGREEMENT.element("AGREE_CODE"),"AGREE_CODE",AGREE_CODE);
					AGREE_NAME=getValue(DM_AGREEMENT.element("AGREE_NAME"),"AGREE_NAME",AGREE_NAME);
					AGREE_ABBR=getValue(DM_AGREEMENT.element("AGREE_ABBR"),"AGREE_ABBR",AGREE_ABBR);
					ORGAN_ID=getValue(DM_AGREEMENT.element("ORGAN_ID"),"ORGAN_ID",ORGAN_ID);
					EFF_DATE=getValue(DM_AGREEMENT.element("EFF_DATE"),"EFF_DATE",EFF_DATE);
					SHARE_CUST=getValue(DM_AGREEMENT.element("SHARE_CUST"),"SHARE_CUST",SHARE_CUST);
					STATUS=getValue(DM_AGREEMENT.element("STATUS"),"STATUS",STATUS);
					PRINT_LOGO=getValue(DM_AGREEMENT.element("PRINT_LOGO"),"PRINT_LOGO",PRINT_LOGO);
					HALL_CODE=getValue(DM_AGREEMENT.element("HALL_CODE"),"HALL_CODE",HALL_CODE);
					HALL_REMIND=getValue(DM_AGREEMENT.element("HALL_REMIND"),"HALL_REMIND",HALL_REMIND);
					ONLINE_PAY=getValue(DM_AGREEMENT.element("ONLINE_PAY"),"ONLINE_PAY",ONLINE_PAY);
					RECORD_TRANS=getValue(DM_AGREEMENT.element("RECORD_TRANS"),"RECORD_TRANS",RECORD_TRANS);
					POS_TRANS=getValue(DM_AGREEMENT.element("POS_TRANS"),"POS_TRANS",POS_TRANS);
					TRADITION_MODE=getValue(DM_AGREEMENT.element("TRADITION_MODE"),"TRADITION_MODE",TRADITION_MODE);					
					String sql="insert into DM_AGREEMENT (AGREE_ID ,AGREE_CODE,PARTNER_ID,AGREE_NAME,AGREE_ABBR,ABSTRACT,ORGAN_ID,BATMAN,EFF_DATE,INEFF_DATE,SHARE_CUST,SIGN_DATE,STATUS,FCD,PRINT_LOGO,HALL_CODE,HALL_REMIND,SUPPORTONLINE,SUPPORTRECORD,SUPPORTPOS,SUPPORTTRADITION)values ("+AGREE_ID+"，'"+AGREE_CODE+"', "+PARTNER_ID+",'"+AGREE_NAME+"','"+AGREE_ABBR+"',null,'"+ORGAN_ID+"',null,"+getDateValue(EFF_DATE)+",null,'"+SHARE_CUST+"',null,'"+STATUS+"',sysdate,'"+PRINT_LOGO+"','"+HALL_CODE+"','"+HALL_REMIND+"','"+ONLINE_PAY+"','"+RECORD_TRANS+"','"+POS_TRANS+"','"+TRADITION_MODE+"')";
					int insertResult=ebean.update_sql(sql);
					log.debug("insertResult:"+insertResult);
				}
			}
			
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void yingxiao_parserXml(String xml)throws Exception{
		try{
			Document doc=DocumentHelper.parseText(xml); 
			Element root=doc.getRootElement();
			Iterator iters=root.elementIterator();
			while(iters.hasNext()){
				String BLUE_ID=Util.ReturnCode();
				String BLUE_CODE=null;
				String BLUE_NAME=null;
				String DEPICT=null;
				String ORGAN_ID=null;
				String SALE_DATE_FST=null;
				String SALE_DATE_LST=null;
				String FCU=null;
				String SERVICER_CODE=null;
				String AGENCY_CODE=null;
				String G_AGENT_CODE=null;
				String STATUS=null;
				String AGREE_CODE=null;
				String AGREE_ID="88888888";
				String FLOW_WAY="3";
				String RECV_PHONE=null;
				String SYS_DEALING=null;
				String SYS_EVENT_CLERK=null;
				String SYS_EVENT_TIME=null;
				String FAMILY_POLICY_BEGIN_ID="0";
				String FAMILY_POLICY_END_ID="0";
				String FAMILY_POLICY_CUR_ID="0";
				String FAMILY_POLICY_QUANTITY="0";
				String BILLNO_CALLBACKED="N";
				String RECV_PHONE_PHY=null;
				String AUTH_TRANS_ID="1";
				String BLUEPRINT_TYPE="1";
				String BLUEPRINT_CATE="1";
				String MAGAZINE_ID=null;
				String DIY_TYPE=null;
				Element DM_BLUEPRINT=(Element)iters.next();
				AGREE_CODE=getValue(DM_BLUEPRINT.element("AGREE_CODE"),"AGREE_CODEE",AGREE_CODE);
				BLUE_CODE=getValue(DM_BLUEPRINT.element("BLUE_CODE"),"BLUE_CODE",BLUE_CODE);
				BLUE_NAME=getValue(DM_BLUEPRINT.element("BLUE_NAME"),"BLUE_NAME",BLUE_NAME);
				DEPICT=getValue(DM_BLUEPRINT.element("DEPICT"),"DEPICT",DEPICT);
				ORGAN_ID=getValue(DM_BLUEPRINT.element("ORGAN_ID"),"ORGAN_ID",ORGAN_ID);
				SALE_DATE_FST=getValue(DM_BLUEPRINT.element("SALE_DATE_FST"),"SALE_DATE_FST",SALE_DATE_FST);
				SALE_DATE_LST=getValue(DM_BLUEPRINT.element("SALE_DATE_LST"),"SALE_DATE_LST",SALE_DATE_LST);
				FCU=getValue(DM_BLUEPRINT.element("FCU"),"FCU",FCU);
				SERVICER_CODE=getValue(DM_BLUEPRINT.element("SERVICER_CODE"),"SERVICER_CODE",SERVICER_CODE);
				AGENCY_CODE=getValue(DM_BLUEPRINT.element("AGENCY_CODE"),"AGENCY_CODE",AGENCY_CODE);
				G_AGENT_CODE=getValue(DM_BLUEPRINT.element("G_AGENT_CODE"),"G_AGENT_CODE",G_AGENT_CODE);
				STATUS=getValue(DM_BLUEPRINT.element("STATUS"),"STATUS",STATUS);
//				AGREE_ID=getValue(DM_BLUEPRINT.element("AGREE_ID"),"AGREE_ID",AGREE_ID);
				FLOW_WAY=getValue(DM_BLUEPRINT.element("FLOW_WAY"),"FLOW_WAY",FLOW_WAY);
				RECV_PHONE=getValue(DM_BLUEPRINT.element("RECV_PHONE"),"RECV_PHONE",RECV_PHONE);
				SYS_DEALING=getValue(DM_BLUEPRINT.element("SYS_DEALING"),"SYS_DEALING",SYS_DEALING);
				SYS_EVENT_CLERK=getValue(DM_BLUEPRINT.element("SYS_EVENT_CLERK"),"SYS_EVENT_CLERK",SYS_EVENT_CLERK);
				SYS_EVENT_TIME=getValue(DM_BLUEPRINT.element("SYS_EVENT_TIME"),"SYS_EVENT_TIME",SYS_EVENT_TIME);
				FAMILY_POLICY_BEGIN_ID=getValue(DM_BLUEPRINT.element("FAMILY_POLICY_BEGIN_ID"),"FAMILY_POLICY_BEGIN_ID",FAMILY_POLICY_BEGIN_ID);
				FAMILY_POLICY_END_ID=getValue(DM_BLUEPRINT.element("FAMILY_POLICY_END_ID"),"FAMILY_POLICY_END_ID",FAMILY_POLICY_END_ID);
				FAMILY_POLICY_CUR_ID=getValue(DM_BLUEPRINT.element("FAMILY_POLICY_CUR_ID"),"FAMILY_POLICY_CUR_ID",FAMILY_POLICY_CUR_ID);
				FAMILY_POLICY_QUANTITY=getValue(DM_BLUEPRINT.element("FAMILY_POLICY_QUANTITY"),"FAMILY_POLICY_QUANTITY",FAMILY_POLICY_QUANTITY);
				BILLNO_CALLBACKED=getValue(DM_BLUEPRINT.element("BILLNO_CALLBACKED"),"BILLNO_CALLBACKED",BILLNO_CALLBACKED);
				RECV_PHONE_PHY=getValue(DM_BLUEPRINT.element("RECV_PHONE_PHY"),"RECV_PHONE_PHY",RECV_PHONE_PHY);
				AUTH_TRANS_ID=getValue(DM_BLUEPRINT.element("AUTH_TRANS_ID"),"AUTH_TRANS_ID",AUTH_TRANS_ID);
				BLUEPRINT_TYPE=getValue(DM_BLUEPRINT.element("BLUEPRINT_TYPE"),"BLUEPRINT_TYPE",BLUEPRINT_TYPE);
				BLUEPRINT_CATE=getValue(DM_BLUEPRINT.element("BLUEPRINT_CATE"),"BLUEPRINT_CATE",BLUEPRINT_CATE);
				MAGAZINE_ID=getValue(DM_BLUEPRINT.element("MAGAZINE_ID"),"MAGAZINE_ID",MAGAZINE_ID);
				DIY_TYPE=getValue(DM_BLUEPRINT.element("DIY_TYPE"),"DIY_TYPE",DIY_TYPE);
				try{
					AGREE_ID=ebean.chaxunString("select AGREE_ID from DM_AGREEMENT where AGREE_CODE='"+AGREE_CODE+"'");
					log.debug("AGREE_ID:"+AGREE_ID);
				}catch(Exception e){
					log.error(Util.getERRO(e));
					yingxiao_parserXml_flag=0;
					return;
				}
				String sql="";
				List list=ebean.chaxun_sql("select * from DM_BLUEPRINT where BLUE_CODE='"+BLUE_CODE+"'");
				if(list!=null&&list.size()>0){
					Map map=(Map)list.get(0);
					BigDecimal BLUE_ID1=(BigDecimal)map.get("BLUE_ID");
					BLUE_ID=BLUE_ID1.toString();
					sql="update DM_BLUEPRINT set BLUE_NAME="+getStringValue(BLUE_NAME)+",DEPICT="+getStringValue(DEPICT)+",ORGAN_ID="+getStringValue(ORGAN_ID)+"," +
							"SALE_DATE_FST="+getDateValue(SALE_DATE_FST)+",SALE_DATE_LST="+getDateValue(SALE_DATE_LST)+",FCD=sysdate,FCU="+FCU+",SERVICER_CODE="+getStringValue(SERVICER_CODE)+"," +
									"AGENCY_CODE="+getStringValue(AGENCY_CODE)+",G_AGENT_CODE="+getStringValue(G_AGENT_CODE)+",STATUS="+STATUS+",AGREE_ID="+AGREE_ID+",FLOW_WAY="+FLOW_WAY+"," +
											"RECV_PHONE="+getStringValue(RECV_PHONE)+",SYS_DEALING="+getStringValue(SYS_DEALING)+",SYS_EVENT_CLERK="+SYS_EVENT_CLERK+",SYS_EVENT_TIME="+getDateValue(SYS_EVENT_TIME)+"," +
													"FAMILY_POLICY_BEGIN_ID="+FAMILY_POLICY_BEGIN_ID+",FAMILY_POLICY_END_ID="+FAMILY_POLICY_END_ID+",FAMILY_POLICY_CUR_ID="+FAMILY_POLICY_CUR_ID+",FAMILY_POLICY_QUANTITY="+FAMILY_POLICY_QUANTITY+"," +
															"BILLNO_CALLBACKED="+getStringValue(BILLNO_CALLBACKED)+",RECV_PHONE_PHY="+getStringValue(RECV_PHONE_PHY)+"," +
																	"AUTH_TRANS_ID="+AUTH_TRANS_ID+",BLUEPRINT_TYPE="+BLUEPRINT_TYPE+",BLUEPRINT_CATE="+BLUEPRINT_CATE+",MAGAZINE_ID="+MAGAZINE_ID+",DIY_TYPE="+DIY_TYPE+" where " +
																			" BLUE_CODE='"+BLUE_CODE+"'";
				}else{
					sql="insert into DM_BLUEPRINT(BLUE_ID,BLUE_CODE,BLUE_NAME,DEPICT,ORGAN_ID,SALE_DATE_FST,SALE_DATE_LST,FCD,FCU,SERVICER_CODE," +
							"AGENCY_CODE,G_AGENT_CODE,STATUS,AGREE_ID,FLOW_WAY,RECV_PHONE,SYS_DEALING,SYS_EVENT_CLERK,SYS_EVENT_TIME,FAMILY_POLICY_BEGIN_ID," +
							"FAMILY_POLICY_END_ID,FAMILY_POLICY_CUR_ID,FAMILY_POLICY_QUANTITY,BILLNO_CALLBACKED,RECV_PHONE_PHY,AUTH_TRANS_ID," +
							"BLUEPRINT_TYPE,BLUEPRINT_CATE,MAGAZINE_ID,DIY_TYPE)" +
					"Values" +
					"("+BLUE_ID+","+getStringValue(BLUE_CODE)+","+getStringValue(BLUE_NAME)+","+getStringValue(DEPICT)+","+getStringValue(ORGAN_ID)+"," +
							""+getDateValue(SALE_DATE_FST)+","+getDateValue(SALE_DATE_LST)+",sysdate,"+FCU+","+getStringValue(SERVICER_CODE)+"," +
									""+getStringValue(AGENCY_CODE)+","+getStringValue(G_AGENT_CODE)+","+STATUS+","+AGREE_ID+","+FLOW_WAY+"," +
											""+getStringValue(RECV_PHONE)+","+getStringValue(SYS_DEALING)+","+SYS_EVENT_CLERK+","+getDateValue(SYS_EVENT_TIME)+"," +
													""+FAMILY_POLICY_BEGIN_ID+","+FAMILY_POLICY_END_ID+","+FAMILY_POLICY_CUR_ID+","+FAMILY_POLICY_QUANTITY+"," +
															""+getStringValue(BILLNO_CALLBACKED)+","+getStringValue(RECV_PHONE_PHY)+","+AUTH_TRANS_ID+"," +
																	""+BLUEPRINT_TYPE+","+BLUEPRINT_CATE+","+MAGAZINE_ID+","+DIY_TYPE+")";
			
				}
				try{
					ebean.update_sql(sql);
					Iterator iters1=DM_BLUEPRINT.elementIterator();
					while(iters1.hasNext()){
						Element DM_BLUEPRINT_BALE=(Element)iters1.next();
						if(DM_BLUEPRINT_BALE.getName().equals("DM_BLUEPRINT_BALE")){
							yingxiao_parserXml2(DM_BLUEPRINT_BALE,BLUE_ID,BLUE_CODE);
						}else if(DM_BLUEPRINT_BALE.getName().equals("DM_BLUEPRINT_BILLNO")){
//							yingxiao_parserXml5(DM_BLUEPRINT_BALE,BLUE_ID);
						}
					}
				}catch(Exception e){
					log.error(Util.getERRO(e));
					sql="insert into DM_BLUEPRINT_bak(BLUE_ID,BLUE_CODE,BLUE_NAME,DEPICT,ORGAN_ID,SALE_DATE_FST,SALE_DATE_LST,FCD,FCU,SERVICER_CODE," +
					"AGENCY_CODE,G_AGENT_CODE,STATUS,AGREE_ID,FLOW_WAY,RECV_PHONE,SYS_DEALING,SYS_EVENT_CLERK,SYS_EVENT_TIME,FAMILY_POLICY_BEGIN_ID," +
					"FAMILY_POLICY_END_ID,FAMILY_POLICY_CUR_ID,FAMILY_POLICY_QUANTITY,BILLNO_CALLBACKED,RECV_PHONE_PHY,AUTH_TRANS_ID," +
					"BLUEPRINT_TYPE,BLUEPRINT_CATE,MAGAZINE_ID,DIY_TYPE)" +
			"Values" +
			"("+getStringValue(BLUE_ID)+","+getStringValue(BLUE_CODE)+","+getStringValue(BLUE_NAME)+","+getStringValue(DEPICT)+","+getStringValue(ORGAN_ID)+"," +
					""+getStringValue(SALE_DATE_FST)+","+getStringValue(SALE_DATE_LST)+",'sysdate',"+getStringValue(FCU)+","+getStringValue(SERVICER_CODE)+"," +
							""+getStringValue(AGENCY_CODE)+","+getStringValue(G_AGENT_CODE)+","+getStringValue(STATUS)+","+getStringValue(AGREE_ID)+","+getStringValue(FLOW_WAY)+"," +
									""+getStringValue(RECV_PHONE)+","+getStringValue(SYS_DEALING)+","+getStringValue(SYS_EVENT_CLERK)+","+getStringValue(SYS_EVENT_TIME)+"," +
											""+getStringValue(FAMILY_POLICY_BEGIN_ID)+","+getStringValue(FAMILY_POLICY_END_ID)+","+getStringValue(FAMILY_POLICY_CUR_ID)+","+getStringValue(FAMILY_POLICY_QUANTITY)+"," +
													""+getStringValue(BILLNO_CALLBACKED)+","+getStringValue(RECV_PHONE_PHY)+","+getStringValue(AUTH_TRANS_ID)+"," +
															""+getStringValue(BLUEPRINT_TYPE)+","+getStringValue(BLUEPRINT_CATE)+","+getStringValue(MAGAZINE_ID)+","+getStringValue(DIY_TYPE)+")";
					ebean.update_sql(sql);
				}
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void biaozhun_parserXml(String xml)throws Exception{
		try{
			Document doc=DocumentHelper.parseText(xml); 
			Element root=doc.getRootElement();
			Iterator iters=root.elementIterator();
			while(iters.hasNext()){
				String BLUE_ID=Util.ReturnCode();
				String BLUE_CODE=null;
				String BLUE_NAME=null;
				String DEPICT=null;
				String SALE_DATE_FST=null;
				String SALE_DATE_LST=null;
				String STATUS="1";
				String FCU=null;
				Element DM_PR_BLUEPRINT_Element=(Element)iters.next();
				BLUE_CODE=getValue(DM_PR_BLUEPRINT_Element.element("BLUE_CODE"),"BLUE_CODE",BLUE_CODE);
				BLUE_NAME=getValue(DM_PR_BLUEPRINT_Element.element("BLUE_NAME"),"BLUE_NAME",BLUE_NAME);
				DEPICT=getValue(DM_PR_BLUEPRINT_Element.element("DEPICT"),"DEPICT",DEPICT);
				SALE_DATE_FST=getValue(DM_PR_BLUEPRINT_Element.element("SALE_DATE_FST"),"SALE_DATE_FST",SALE_DATE_FST);
				SALE_DATE_LST=getValue(DM_PR_BLUEPRINT_Element.element("SALE_DATE_LST"),"SALE_DATE_LST",SALE_DATE_LST);
				FCU=getValue(DM_PR_BLUEPRINT_Element.element("FCU"),"FCU",FCU);
				STATUS=getValue(DM_PR_BLUEPRINT_Element.element("STATUS"),"STATUS",STATUS);
				if(STATUS==null||STATUS.equals("")||STATUS.length()==0){
					STATUS="1";
				}
				String sql="";
				List list=ebean.chaxun_sql("select * from DM_PR_BLUEPRINT where BLUE_CODE='"+BLUE_CODE+"'");
				if(list!=null&&list.size()>0){
					Map map=(Map)list.get(0);
					BigDecimal BLUE_ID1=(BigDecimal)map.get("BLUE_ID");
					BLUE_ID=BLUE_ID1.toString();
					sql="update DM_PR_BLUEPRINT set BLUE_NAME="+getStringValue(BLUE_NAME)+",DEPICT="+getStringValue(DEPICT)+",SALE_DATE_FST="+getDateValue(SALE_DATE_FST)+"," +
							"SALE_DATE_LST="+getDateValue(SALE_DATE_LST)+",STATUS="+STATUS+",FCD=sysdate,FCU="+FCU+" where BLUE_CODE='"+BLUE_CODE+"'";
				}else{
					sql="insert into DM_PR_BLUEPRINT(BLUE_ID,BLUE_CODE,BLUE_NAME,DEPICT,SALE_DATE_FST,SALE_DATE_LST,STATUS,FCD,FCU)" +
					"Values("+BLUE_ID+","+getStringValue(BLUE_CODE)+","+getStringValue(BLUE_NAME)+","+getStringValue(DEPICT)+"," +
							""+getDateValue(SALE_DATE_FST)+","+getDateValue(SALE_DATE_LST)+","+STATUS+",sysdate,"+FCU+")";
		
				}
				try{
					ebean.update_sql(sql);
					Iterator iters1=DM_PR_BLUEPRINT_Element.elementIterator();
					while(iters1.hasNext()){
						Element DM_PR_BLUE_BALE_Element=(Element)iters1.next();
						if(DM_PR_BLUE_BALE_Element.getName().equals("DM_PR_BLUE_BALE")){
							biaozhun_parserXml1(DM_PR_BLUE_BALE_Element,BLUE_ID);
						}
					}
				}catch(Exception e){
					log.error(Util.getERRO(e));
					sql="insert into DM_PR_BLUEPRINT_bak(BLUE_ID,BLUE_CODE,BLUE_NAME,DEPICT,SALE_DATE_FST,SALE_DATE_LST,STATUS,FCD,FCU)" +
					"Values("+getStringValue(BLUE_ID)+","+getStringValue(BLUE_CODE)+","+getStringValue(BLUE_NAME)+","+getStringValue(DEPICT)+"," +
							""+getStringValue(SALE_DATE_FST)+","+getStringValue(SALE_DATE_LST)+","+getStringValue(STATUS)+",'sysdate',"+getStringValue(FCU)+")";
					ebean.update_sql(sql);
				}
			}
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	private void parserXml(String xml) throws Exception{
		try{
			Document doc=DocumentHelper.parseText(xml); 
			Element root=doc.getRootElement();
			Element START=root.element("START");
			Iterator iters=START.elementIterator();
			while(iters.hasNext()){
				int judge=1;
				String HALL_ID=Util.ReturnCode();
				String HALL_CODE=null;
				String PARENT_CODE=null;
				String LEAF=null;
				String HALL_NAME=null;
				String HALL_ABBR=null;
				String STATUS=null;
				String ORGAN_ID=null;
				String OWNER=null;
				String AREA_CODE=null;
				String ADDR=null;
				String ZIP=null;
				String TEL=null;
				String FAX=null;
				String EMAIL=null;
				String FCD=null;
				String PRINCIPAL_ID=null;
				String GRADE=null;
				String TELLER_NUMBER=null;
				String UPDATE_TIME=null;
				String IS_BANK_PROJECT=null;
				Element DM_FS_SEAT_HALL_Element=(Element)iters.next(); 
				HALL_CODE=getValue(DM_FS_SEAT_HALL_Element.element("HALL_CODE"),"HALL_CODE",HALL_CODE);
				PARENT_CODE=getValue(DM_FS_SEAT_HALL_Element.element("PARENT_CODE"),"PARENT_CODE",PARENT_CODE);
				if(PARENT_CODE!=null&&PARENT_CODE.equals("")){
					PARENT_CODE=null;
				}
				LEAF=getValue(DM_FS_SEAT_HALL_Element.element("LEAF"),"LEAF",LEAF);
				HALL_NAME=getValue(DM_FS_SEAT_HALL_Element.element("HALL_NAME"),"HALL_NAME",HALL_NAME);
				HALL_ABBR=getValue(DM_FS_SEAT_HALL_Element.element("HALL_ABBR"),"HALL_ABBR",HALL_ABBR);
				STATUS=getValue(DM_FS_SEAT_HALL_Element.element("STATUS"),"STATUS",STATUS);
				ORGAN_ID=getValue(DM_FS_SEAT_HALL_Element.element("ORGAN_ID"),"ORGAN_ID",ORGAN_ID);
				OWNER=getValue(DM_FS_SEAT_HALL_Element.element("OWNER"),"OWNER",OWNER);
				AREA_CODE=getValue(DM_FS_SEAT_HALL_Element.element("AREA_CODE"),"AREA_CODE",AREA_CODE);
				ADDR=getValue(DM_FS_SEAT_HALL_Element.element("ADDR"),"ADDR",ADDR);
				ZIP=getValue(DM_FS_SEAT_HALL_Element.element("ZIP"),"ZIP",ZIP);
				TEL=getValue(DM_FS_SEAT_HALL_Element.element("TEL"),"TEL",TEL);
				FAX=getValue(DM_FS_SEAT_HALL_Element.element("FAX"),"FAX",FAX);
				EMAIL=getValue(DM_FS_SEAT_HALL_Element.element("EMAIL"),"EMAIL",EMAIL);
				PRINCIPAL_ID=getValue(DM_FS_SEAT_HALL_Element.element("PRINCIPAL_ID"),"PRINCIPAL_ID",PRINCIPAL_ID);
				GRADE=getValue(DM_FS_SEAT_HALL_Element.element("GRADE"),"GRADE",GRADE);
				UPDATE_TIME=getValue(DM_FS_SEAT_HALL_Element.element("UPDATE_TIME"),"UPDATE_TIME",UPDATE_TIME);
				IS_BANK_PROJECT=getValue(DM_FS_SEAT_HALL_Element.element("IS_BANK_PROJECT"),"IS_BANK_PROJECT",IS_BANK_PROJECT);
				String sql="";
				if(PARENT_CODE!=null&&!PARENT_CODE.equals("")&&PARENT_CODE.length()>0){
					try{
						PARENT_CODE=ebean.chaxunString("select hall_id from dm_fs_seat_hall where hall_code='"+PARENT_CODE+"'");
					}catch(Exception e){
						log.error(Util.getERRO(e));
						sql="insert into DM_FS_SEAT_HALL_bak(HALL_ID,HALL_CODE,PARENT_ID,LEAF,HALL_NAME,HALL_ABBR," +
						"STATUS,ORGAN_ID,OWNER,AREA_CODE,ADDR,ZIP,TEL,FAX,EMAIL," +
						"FCD,PRINCIPAL_ID,GRADE,TELLER_NUMBER,UPDATE_TIME,IS_BANK_PROJECT)Values("+HALL_ID+","+getStringValue(HALL_CODE)+"," +
								""+getStringValue(PARENT_CODE)+","+getStringValue(LEAF)+"," +
								""+getStringValue(HALL_NAME)+","+getStringValue(HALL_ABBR)+","+getStringValue(STATUS)+","+getStringValue(ORGAN_ID)+"," +
										""+getStringValue(OWNER)+"," +
										""+getStringValue(AREA_CODE)+","+getStringValue(ADDR)+","+getStringValue(ZIP)+","+getStringValue(TEL)+"," +
										""+getStringValue(FAX)+","+getStringValue(EMAIL)+",'sysdate',"+getStringValue(PRINCIPAL_ID)+"," +
												""+getStringValue(GRADE)+","+TELLER_NUMBER+"," +
												""+getStringValue(UPDATE_TIME)+","+getStringValue(IS_BANK_PROJECT)+")";
						ebean.update_sql(sql);
						judge=0;
					}

				}
				List list=ebean.chaxun_sql("select * from DM_FS_SEAT_HALL where HALL_CODE='"+HALL_CODE+"'");
				if(list!=null&&list.size()>0){
					Map map=(Map)list.get(0);
					BigDecimal HALL_ID1=(BigDecimal)map.get("HALL_ID");
					HALL_ID=HALL_ID1.toString();
					sql="update DM_FS_SEAT_HALL set LEAF="+getStringValue(LEAF)+",HALL_NAME="+getStringValue(HALL_NAME)+",HALL_ABBR="+getStringValue(HALL_ABBR)+"," +
							"STATUS="+STATUS+",ORGAN_ID="+getStringValue(ORGAN_ID)+",OWNER="+OWNER+",AREA_CODE="+getStringValue(AREA_CODE)+",ADDR="+getStringValue(ADDR)+"," +
									"ZIP="+getStringValue(ZIP)+",TEL="+getStringValue(TEL)+",FAX="+getStringValue(FAX)+",EMAIL="+getStringValue(EMAIL)+",FCD=sysdate," +
											"PRINCIPAL_ID="+PRINCIPAL_ID+",GRADE="+GRADE+",TELLER_NUMBER="+TELLER_NUMBER+"," +
													"UPDATE_TIME="+getDateValue(UPDATE_TIME)+",IS_BANK_PROJECT="+IS_BANK_PROJECT+" " +
															"where HALL_CODE='"+HALL_CODE+"'";
					
				}else{
					sql="insert into DM_FS_SEAT_HALL(HALL_ID,HALL_CODE,PARENT_ID,LEAF,HALL_NAME,HALL_ABBR," +
					"STATUS,ORGAN_ID,OWNER,AREA_CODE,ADDR,ZIP,TEL,FAX,EMAIL," +
					"FCD,PRINCIPAL_ID,GRADE,TELLER_NUMBER,UPDATE_TIME,IS_BANK_PROJECT)Values("+HALL_ID+","+getStringValue(HALL_CODE)+"," +
							""+PARENT_CODE+","+getStringValue(LEAF)+"," +
							""+getStringValue(HALL_NAME)+","+getStringValue(HALL_ABBR)+","+STATUS+","+getStringValue(ORGAN_ID)+","+OWNER+"," +
									""+getStringValue(AREA_CODE)+","+getStringValue(ADDR)+","+getStringValue(ZIP)+","+getStringValue(TEL)+"," +
									""+getStringValue(FAX)+","+getStringValue(EMAIL)+",sysdate,"+PRINCIPAL_ID+","+GRADE+","+TELLER_NUMBER+"," +
											""+getDateValue(UPDATE_TIME)+","+IS_BANK_PROJECT+")";
				}
				try{
					if(judge==1){
						ebean.update_sql(sql);
					}
					Iterator iters1=DM_FS_SEAT_HALL_Element.elementIterator();
					while(iters1.hasNext()){
						Element DM_FS_SEAT_DEPT=(Element)iters1.next();
						if(DM_FS_SEAT_DEPT.getName().equals("DM_FS_SEAT_DEPT")){
							parserXml(DM_FS_SEAT_DEPT,HALL_ID);
						}
					}
				}catch(Exception e){
					log.error(Util.getERRO(e));
					sql="insert into DM_FS_SEAT_HALL_bak(HALL_ID,HALL_CODE,PARENT_ID,LEAF,HALL_NAME,HALL_ABBR," +
					"STATUS,ORGAN_ID,OWNER,AREA_CODE,ADDR,ZIP,TEL,FAX,EMAIL," +
					"FCD,PRINCIPAL_ID,GRADE,TELLER_NUMBER,UPDATE_TIME,IS_BANK_PROJECT)Values("+HALL_ID+","+getStringValue(HALL_CODE)+"," +
							""+getStringValue(PARENT_CODE)+","+getStringValue(LEAF)+"," +
							""+getStringValue(HALL_NAME)+","+getStringValue(HALL_ABBR)+","+getStringValue(STATUS)+","+getStringValue(ORGAN_ID)+"," +
									""+getStringValue(OWNER)+"," +
									""+getStringValue(AREA_CODE)+","+getStringValue(ADDR)+","+getStringValue(ZIP)+","+getStringValue(TEL)+"," +
									""+getStringValue(FAX)+","+getStringValue(EMAIL)+",'sysdate',"+getStringValue(PRINCIPAL_ID)+"," +
											""+getStringValue(GRADE)+","+TELLER_NUMBER+"," +
											""+getStringValue(UPDATE_TIME)+","+getStringValue(IS_BANK_PROJECT)+")";
					ebean.update_sql(sql);
				}
			}				
		}catch(Exception e){
			log.error(Util.getERRO(e));
			throw e;
		}
	}
	public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException{
//		String dm_tpimport_bakelite_result=ebean.dm_tpimport_bakelite();
//		log.info("dm_tpimport_bakelite:"+dm_tpimport_bakelite_result);		
		String encoding=request.getCharacterEncoding();
		log.info("encoding:"+encoding);
		if(encoding==null||encoding.equals("")){
			encoding="UTF-8";
		}
		log.info("encoding1:"+encoding);
		String type=request.getParameter("type");
		log.info("type:"+type);
		DiskFileUpload fu=new DiskFileUpload();  
		fu.setHeaderEncoding(encoding);
		try{
			List fileItems=fu.parseRequest(request);
			Iterator i=fileItems.iterator();
			while(i.hasNext()){
				FileItem fi=(FileItem)i.next();
				String fifileName=fi.getName();
				BufferedReader rd=new BufferedReader(new InputStreamReader(fi.getInputStream(),"gbk"));
				String temp=null;
				StringBuffer sb=new StringBuffer();
				while((temp=rd.readLine())!=null){
					sb.append(temp);
				}
				String xml=sb.toString();
				log.info("xml:"+xml);
				try {
					if(type.equals("01")){
						parserXml(xml);
					}else if(type.equals("02")){
						biaozhun_parserXml(xml);
					}else if(type.equals("03")){
						yingxiao_parserXml(xml);
					}else if(type.equals("04")){
						xieyi_parserXml(xml);
					}
				} catch (Exception e) {
					log.error(Util.getERRO(e));
				}
			}
		}catch (FileUploadException e) {
			log.error(Util.getERRO(e));
		}
		if(yingxiao_parserXml_flag==1){
			response.sendRedirect("result.jsp");
		}else{
			response.sendRedirect("result1.jsp");
		}
		
	}

}